Thursday, April 18, 2013

Language Wishlist

I have a wishlist, I came across today of a few things I would really like the language that I would love to write to be able to do.

Write a foreach loop and use the syntax below (basically perl but a little weird looking)

foreach , ,... (@variablearray1, @variablearray2,... @variablearrayn)
 So I can loop through multiple arrays in the same iteration and not have to have arrays of arrays or other crazy stuff.

Also I would like to be able to pick a "random order" of ALL of the arrays, but the indexes are linked, I.E.
@array1 = lah,bl,a,we
@array2 = 1,2,3,4

I would love to see a "random function" or keyword, I can use that will rearrange it to something like this:

@array1 = bl, we, a, lah
@array2 = 2,4,3,1

(basically the original indices stay matched).

Now of course I could write a tool which will do the second one. and I could write a "templating language" which would essentially replace ,... with $variablearray1[$i] and the foreach to a for loop but well that's annoying I....maybe one day I will...we'll see.