Problem with Arguments inheriting from Array

Mark S. Miller erights at google.com
Tue Aug 18 11:38:02 PDT 2009


On Tue, Aug 18, 2009 at 11:29 AM, Brendan Eich<brendan at mozilla.org> wrote:
> On Aug 18, 2009, at 8:46 AM, John Cowan wrote:
>
>> Mark S. Miller scripsit:
>>
>>> I am not yet taking a position on whether non-strict arguments should
>>> revert to inheriting from Object.prototype.
>>
>> I believe we should.  Leave the horrible thing alone, and refrain
>> from turning over stones for fear of seeing the maggots beneath.
>
> Yes, this is my mantra. Onward to rest, default parameters, and the spread
> operator!
>
> http://wiki.ecmascript.org/doku.php?id=harmony:rest_parameters
> http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values
> http://wiki.ecmascript.org/doku.php?id=harmony:spread
>
>>
>>> [W]e should make strict arguments simply *be* an array.
>>
>> Emphatic +1
>
> -1 (again; I was against this last year at the Kona meeting, and I still
> am).
>
> We don't need more divergent code paths (optimization and security bug
> habitat) in implemetations, or (obvious from Oliver's results) developer
> pain coping with strict arguments being an array and breaking extant code
> that would otherwise easily move under "use strict".


But you think having non-strict arguments inherit from
Object.prototype while strict arguments inherit from Array.prototype
doesn't have all these same problems?

Again, if we do not change non-strict arguments to inherit from
Object.prototype, then I also do not suggest we change strict
arguments to be an array. Only if we do change non-strict arguments to
inherit from Object.prototype, then we've already paid all the costs
you mention above, so we may as well collect some benefit.

-- 
    Cheers,
    --MarkM


More information about the es5-discuss mailing list