array like objects

Brendan Eich brendan at
Tue Dec 8 12:00:30 PST 2009

On Dec 8, 2009, at 11:51 AM, Erik Corry wrote:

>> for (let i in arraylike) {
>>    i |= 0;
> If this pattern catches on then we could optimize for it without
> changing the language.

Yeah, but some day there will be only "new" versions in which i is  
numeric for arraylikes and that becomes pointless. On that fine day  
programmers can stop writing the ugly extra statement. That's worth  
something too, even as a new loop construct "could be nicer".

Do we want nicer with high migration tax and greater total language  
complexity (new loop construct), or nicer with lower tax (reformed for- 
in under new opt-in version), or not-so-nice with perpetual type-fixup  
kludge (what you seem resigned to :-P).

> I think returning integers from for-in is a
> complete non-starter but I'm not volunteering to build a browser that
> does it just so I can check what breaks.

I'll handle that chore...


More information about the es-discuss mailing list