change behavior of Array.prototype.push?

Caitlin Potter caitpotter88 at gmail.com
Sat Oct 29 23:40:56 UTC 2016


What do you mean by “nobody’s stuff broke”?

I would be surprised if nothing broke if v8 or JavaScriptCore or Chakra switched to the FireFox approach (which is only broken in the specific case where the target is a JSArray, based on what Jordan is saying). If you can prove that nothing breaks if other browsers implement that change (and, if similar changes are implemented for pop/shift/unshift, since IMHO those apis need to behave consistently), then maybe it’s not an unreasonable change.

> On Oct 29, 2016, at 7:07 PM, Jann Horn <jann at thejh.net> wrote:
> 
> On Sat, Oct 29, 2016 at 03:15:48PM -0700, Jordan Harband wrote:
>> That just means anyone relying on that behavior is broken in Firefox - if
>> their code would work in all of the other browsers, then it's a Firefox
>> bug, not something the spec can change.
> 
> But apparently, nobody's stuff broke.
> In the Linux kernel, the approach to API changes is basically "you can
> change things as long as no existing userspace code breaks because of
> those changes", which I think is reasonable.
> And as far as I can tell, ECMAScript uses a similar approach; for
> example, AFAIK in ECMAScript 6.0, the following code would have worked,
> but ECMAScript 7.0 breaks it (by making %ObjectPrototype% an immutable
> prototype exotic object):
> 
>    Reflect.setPrototypeOf(Object.prototype, {__proto__:null, a:1});
>    console.log(({}).a);
> 
> So clearly, reasonable breakage in new ECMAScript versions is permitted.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list