Day 2 meeting notes
faisalv at yahoo.com
Fri Jul 30 15:53:41 PDT 2010
> ---------- Forwarded message ----------
> From: Douglas Crockford <douglas at crockford.com>
> To: Oliver Hunt <oliver at apple.com>
> Date: Fri, 30 Jul 2010 13:09:33 -0700
> Subject: Re: Re: Day 2 meeting notes
> On 11:59 AM, Oliver Hunt wrote:
>> 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.
> I agree. We talked about swapping out the preposition, so for..in produces keys, and for..of or for..from produces values.
What about using 'for .. vin' - i.e. value-in for value enumeration
And adding a redundant 'for .. kin' - i.e. key-in for key enumeration
(for those who prefer explicitness over using the ambiguously named
'for .. in' which would retain its original key iteration behavior)?
Or are 'vin' and 'kin' too nonsensical to gain any acceptance?
More information about the es-discuss