Re: foreach

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

OK, maybe issue was too strong a word, but all I meant was that there are some things that need to be considered, and decided upon, before we implement a foreach statement. If we prematurely implement it we may have to break code using the first implementation or curtail some important changes once we had more time to consider it.

Is their an issue with the most basic form of foreach and then adding features in 4.1? i.e.

s = {1,2,3} 
foreach x in s do 
    ? x 
end foreach 
 
-- being identical to: 
 
s = {1,2,3} 
for i = 1 to length(s) do 
    object x = s[i] 
    ? x 
end for 

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.

Jeremy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu