On 7/29/10 16:55, Oliver Hunt wrote:
On Jul 29, 2010, at 2:47 PM, Waldemar Horwat wrote:
Comprehensions: To be useful, need to have a bunch of basic helpers
such as range(), properties(), values(), etc. with short names that
can be used to construct comprehensions. These will be added to the
proposal.
Would like to be able to interleave for and if clauses:
[x*y for (x in range(...)) if (isprime(x)) for (y in range(x+1...)) if
(isprime(y))]
I keep seeing code like this, I simply don't see it as viable to have "for (.. in
...)" sometimes enumerate property names, and some times enumerate keys, it seems
like it could be both confusing and error prone. esp. given the simplest example: [x for
(value in [1,2,3])] you would not get the desired behaviour, unless in comprehensions
for(in) behaves differently from everywhere else.
It seems far better to just define a distinct syntax for enumerating values of
an object.
actionscript 3 has
for (key in a) {}
for each (val in a) {}
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss