Skip to content

passing ls:let down through multiple levels #132

Description

@arthurhjorth

from our paper:

Importantly, ls:let exists in the context of a parent. This means that the value of a ls:let cannot be passed down through grand children without having to use ls:let again. I.e.

ls:let num-turtles count turtles
ls:ask 0 [
  ls:ask 0 [
    create-turtles num-turtles ;; WILL ERROR
    ]
  ]

Rather, the modeler would need to ask its child model to re-assign the ls:let in its own context, and then pass that into its own child model – the grandchild of the original model:

ls:let num-turtles count turtles
ls:ask 0 [
  ls:let child-num-turtles num-turtles
  ls:ask 0 [
    create-turtles child-num-turtles
    ]
  ]

Any way around this?

Activity

  1. qiemem commented on Aug 9, 2018

    @qiemem
    Member

    I can think of a few things, but the need for it has never come up in practice. I would prefer to wait until we have real world examples of when its needed before deciding on a solution.

    I don't think it actually needs to be addressed in the paper. I would just say "ls:let exposes data from the parent to the child." or something.

  2. arthurhjorth commented on Aug 9, 2018

    @arthurhjorth
    ContributorAuthor

    I can think of a few things, but the need for it has never come up in practice. I would prefer to wait until we have real world examples of when its needed before deciding on a solution.

    For me it's really more about consistency in how we think of let and ls:let, which also gets at:

    I don't think it actually needs to be addressed in the paper. I would just say "ls:let exposes data from the parent to the child." or something.

    I definitely think it does. I think it will be confusing to anyone who doesn't know the implementation of ls:let + ls:ask or ls:of to understand why

    let foo "bar"
    ask turtle 0 [
      ask turtle 1 [
        show foo
        ]
      ]
    

    works but

    ls:let num-turtles count turtles
    ls:ask 0 [
      ls:ask 0 [
        create-turtles num-turtles ;; WILL ERROR
        ]
      ]
    

    does not. Don't you?

  3. arthurhjorth commented on Aug 9, 2018

    @arthurhjorth
    ContributorAuthor

    Btw, this isn't an argument for fixing this right this minute. But I do think this would be a nice fix down the road, and definitely should be in the paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions