array like objects

Brendan Eich brendan at mozilla.com
Tue Dec 8 13:03:41 PST 2009


On Dec 8, 2009, at 12:52 PM, Mike Samuel wrote:

> 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 :)

I remember VMS. Not as good as TOPS-20 :-P.

Seriously, opt-in versioning will not be via too many "use mumble"  
pragmas, rather whole-edition selection a la RFC 4329. The "use  
strict" idea is good but we don't want endless feature knobs (we =  
everyone, TC39, developers, implementors).

More, while in-language version selection may yet happen, I don't see  
how it helps with new syntax. You'll get syntax errors from old  
browsers without any way to handle them (no fallback or alt content  
for <script>).

More controllable (for authors) is something like the sketch here:

http://wiki.ecmascript.org/doku.php?id=proposals:versioning

linked from

http://wiki.ecmascript.org/doku.php?id=strawman:versioning

Your thoughts and edits are welcome on this last page.

/be



More information about the es-discuss mailing list