array like objects

Mike Samuel mikesamuel at gmail.com
Tue Dec 8 12:52:21 PST 2009


2009/12/8 Brendan Eich <brendan at mozilla.com>:
> 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

Well, we have "use strict," and then this would give us "use integer,"
so all that leaves would be an excuse to shoehorn "use vmsish" into
the language :)

> (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...
>
> /be
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list