Posted: 23rd Nov 2011 4:18
I think Lee would probably like to avoid adding reference types, etc. to the language. A much simpler change could be to allow things like this:

+ Code Snippet
for i in myarray[]
    myarray[i] = 1 `Do something to element
next i


It only introduces one keyword ("in <array>") which translates directly into "= 0 to <length of array>" and doesn't require changes to the AppGameKit player.

The next thing that is definitely needed is the "continue" and "redo" commands to complement the "exit" command. "continue" should jump to the next iteration of a loop. "redo" should jump to the start of the current iteration.

"continue" allows you to skip a loop without having loads of nested if statements:
+ Code Snippet
for i in myarray[]
    ` Skip cases where myarray[i] is negative
    if myarray[i] &lt; 0 then continue
    
    ` Do stuff
next i


"redo" allows you to easily delete from an array while looping through it:
+ Code Snippet
for i in myarray[]
    if myarray[i] = 1
        delete myarray[], i
        redo
    endif
next i
Posted: 23rd Nov 2011 17:46
I agree with Diggsey and understand the issue Airslide raises. IMO the foreach should return the index of the array it is iterating as oppose to a reference or copy of the actual element. So Airslides example would become:

+ Code Snippet
foreach bulletIndex in bullets[]
	MoveBullet( bulletIndex )
next bullet

function MoveBullet( bulletIndex )
	bullets[bulletIndex].x = bullets[bulletIndex].x + 1
endfunction


Save the confusion of passing by reference.

Dynamic arrays should be high on the list (With Push/Pop/size functions) to....I would say associative arrays would be nice but maybe thats just a personal love of mine
Posted: 24th Nov 2011 10:47
I can do without associative arrays, but dynamics arrays is a must. It's hard to write my xml parser without them.