Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing ls:let down through multiple levels #132

Open
arthurhjorth opened this issue Aug 9, 2018 · 3 comments
Open

passing ls:let down through multiple levels #132

arthurhjorth opened this issue Aug 9, 2018 · 3 comments

Comments

@arthurhjorth
Copy link
Member

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?

@qiemem
Copy link
Member

qiemem commented Aug 9, 2018

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.

@arthurhjorth
Copy link
Member Author

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?

@arthurhjorth
Copy link
Member Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants