On Nov 21, 2010, at 7:41 PM, Brendan Eich wrote: > On Nov 21, 2010, at 7:21 PM, Chris Sells wrote: > >> I'm a huge fan of iterators. As far as index goes, I'm not a fan of the use >> of the colon. We should take our time, but something that I wanted to throw >> into the pot would be to build on the key-based nature of for-in with syntax >> like this: >> >> forvals ( var x in xs ) {...} > > Resist bikeshedding early and all that, but there's already a strike against > this or anything like it: > > JS lacks run-together keywords apart from typeof and instanceof, which do not > abbreviate as "vals" does. > > In grasping for ":" instead of "in", the committee was trying to keep the > introductory keyword "for". I think we had agreement that sticking with "for" > is still worth using as a syntax design guide or "back up and try another > route forward [than 'in']" design point.
And (sorry, I'll try to keep replies in one message next time) "for" vs. "forvals" does not exactly scream "keys" vs. "values", since "for" is only about "keys" if you know ECMA-262 and expect the mystery meat of enumeration. If we manage to make normative specifications for enumeration, which has been a goal recently, we'll still have "for-in" for that "keys" meaning. So there won' t be any "keys" : "vals" symmetry to play off of, just some longer or different syntax for meta-programmable iteration. Which raises another point: meta-programmable iteration is not necessarily about "values" and not "keys". A custom iterator could (and in the strawman does) return key/value pairs. The whole keys vs. values dilemma is a false one here. /be _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss