Array comprehension syntax
allen at wirfs-brock.com
Sat Sep 22 10:51:19 PDT 2012
On Sep 22, 2012, at 10:39 AM, Brendan Eich wrote:
> Jason Orendorff wrote:
> Yeah, not as strong a precedent -- we should treat JS as big brother here, over time.
>> I actually kind of like Allen's argument about not wanting to
>> encourage the use of array comprehensions for complicated use cases.
>> However I'm not sure how that squares with a distaste for nanny syntax
> Yup. I thought perhaps Allen left out a "not" or otherwise inverted his meaning, though.
I don't think so:
> My personal bias, is that comprehensions are just sugar that are best used to express relatively simple and common construction use cases. Complicated sequences of |for| and |if| clauses will be rarely seen and hence less understandable than the equivalent explicit looping expansions.
My personal preference would be:
1) don't have comprehensions at all (but that's not harmonious, so I'm not actually suggesting it)
2) a) one or more fir clauses followed by a single optional if clause (what is currently in the draft)
More information about the es-discuss