elfe icon indicating copy to clipboard operation
elfe copied to clipboard

For loop

Open c3d opened this issue 10 years ago • 0 comments

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.

c3d avatar Jul 15 '15 21:07 c3d