Re: foreach

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
jeremy said...

In 4.1 we can safely add features such as updating x and have it reflected in the original list, adding a reversed parameter, etc... As said previously, the above would cover 90% of all uses of foreach.

It can only be safely done if, in 4.0, x is treated like a for loop variable currently is (i.e., no assignment possible).

That sounds fine to me. Later, in 4.1 we can enhance these things and the 4.1 feature list can say "foreach variable now assignable!"

mattlewis said...

And to lump something else in there, what about [optionally] specifying a type for the 'each'?

foreach integer c in my_string do 
    -- ... 
end foreach 

This is for speed I guess? I'm all for giving the interpreter/translator the necessary information for optimizing.

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu