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

For loop #7

Open
c3d opened this issue Jul 15, 2015 · 0 comments
Open

For loop #7

c3d opened this issue Jul 15, 2015 · 0 comments

Comments

@c3d
Copy link
Owner

c3d commented Jul 15, 2015

For loops cannot be defined presently, because there is no longer a way to pass down a variable name to be updated. Here is a naive definition:

for Var in Low..High loop Body ->
    Var := Low
    while Var <= High loop
        Body
        Var := Var + 1

This does not work because Var will be passed as a reference and correctly evaluated everywhere except in assignments. So Var+1 will evaluate the input variable plus one. But Var := Low will create a local variable name Var since none exists.

Still thinking about the right way to do that. One option is to simply modify := when assigning to a reference. Another is to have some kind of special reference type.

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

1 participant