Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-23 Thread Brendan Eich
No one has taken my bet :-P. /be Mark S. Miller wrote: On Sun, Feb 22, 2015 at 3:12 PM, Mark S. Miller erig...@google.com mailto:erig...@google.com wrote: Array.prototype has reverted to being an empty initially empty exotic array object. Function.prototype remains a no-op

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-23 Thread Mark S. Miller
Since gambling with real money is technically still illegal, I have responded to Brendan privately. On Mon, Feb 23, 2015 at 10:35 AM, Brendan Eich bren...@mozilla.org wrote: No one has taken my bet :-P. /be Mark S. Miller wrote: On Sun, Feb 22, 2015 at 3:12 PM, Mark S. Miller

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-22 Thread Isiah Meadows
Is Array.prototype an exotic Array Instance? Or is it still a standard exotic object? This is somewhat relevant to V8 bug 3890 https://code.google.com/p/v8/issues/detail?id=3890, which is targeted at implementing that change. -- Isiah Meadows ___

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-22 Thread Mark S. Miller
On Sun, Feb 22, 2015 at 3:12 PM, Mark S. Miller erig...@google.com wrote: Array.prototype has reverted to being an empty initially empty exotic array object. Function.prototype remains a no-op function object. Empty in terms of the indexed properties, and with a .length of 0. Array.prototype

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-22 Thread Mark S. Miller
Array.prototype has reverted to being an empty initially empty exotic array object. Function.prototype remains a no-op function object. All the other X.prototypes remain plain vanilla non-exotic objects. On Sun, Feb 22, 2015 at 2:33 PM, Isiah Meadows isiahmead...@gmail.com wrote: Is

RE: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-21 Thread Gary Guo
To me I would like it to be reverted for back-compatiblity. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-20 Thread Claude Pache
Le 20 févr. 2015 à 02:11, Kyle Simpson get...@gmail.com a écrit : Just curious… for RegExp, Date, String and the others that *are* changing to plain objects… does that mean `Object.prototype.toString.call( .. )` will return [object Object] on them? Sorry, I've kinda gotten lost on what

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-20 Thread Brendan Eich
Has any engine tried implementing the ES6 changes from ur-instances to plain objects? We are kidding ourselves about this change being web compatible if the answer is no. I would bet real money that something will break. Who wants to wager? /be Allen Wirfs-Brock wrote: On Feb 19, 2015,

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Axel Rauschmayer
On 19 Feb 2015, at 21:09, Andrea Giammarchi andrea.giammar...@gmail.com wrote: if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong with having these as we always had already: as prototypes? I find it more self-explanatory. Here, prototypes are taking

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Mark Miller
On Thu, Feb 19, 2015 at 12:14 PM, Axel Rauschmayer a...@rauschma.de wrote: However, you can’t freeze `Array.prototype` We do. -- Cheers, --MarkM ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
yep, not only you can, but also consider if that was frozen, half of ES5 wouldn't have existed. You want to exted it? Thanks to ES5 just go for it! You want to be obtrusive or that secure? Freeze it. Does this affect the ability to use Array.prototype as empty array? Not at all, it does not

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
P.S. yes, the semantic already frozen purpose of an empty property though, I agree that'd be cool On Thu, Feb 19, 2015 at 8:21 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: yep, not only you can, but also consider if that was frozen, half of ES5 wouldn't have existed. You want to

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Jordan Harband
Personally I'd love to see `Array.empty`, `Function.empty`, `Map.empty`, `String.empty`, etc as nonconfigurable nonwritable frozen/sealed/extensionsPrevented available by default - that might provide the (polyfillable) use case Kyle is currently describing, and might provide a path to making

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Kyle Simpson
are there any other builtins that anybody (Kyle, or otherwise) sees as problematic to continue with the breaking change As that book chapter mentions, the only other one I've ever used is RegExp.prototype (being the default empty match /(?:)/ regular expression). I have used that only once

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong with having these as we always had already: as prototypes? I see just moving and duplicating gotchas, instead of keeping in a well known behavior. This exotic problem ... I never really understood it, I

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Kyle Simpson
you want to freeze everything *.empty I don't think most of those *need* to be frozen, per se, since they're already immutable: `Function`, `String`, `Number`, `Boolean`, `RegExp`, … all immutable themselves. `Array.prototype` is however mutable (`Array.prototype.push(1,2,3)`), so freezing it

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Kyle Simpson
I just remembered that I also do a sort of `Object.empty` in my own code somewhat frequently, as can be seen here for example: https://github.com/getify/asynquence/blob/master/asq.src.js#L826 Declaring an empty object: `var ø = Object.create(null)`, and then using that `ø` as a sort of global

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Allen Wirfs-Brock
On Feb 19, 2015, at 12:09 PM, Andrea Giammarchi wrote: if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong with having these as we always had already: as prototypes? Just to keep things focused. *.empty is not something that is on the table for ES6. It

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Michał Wadas
Is there a good reason behind making prototypes ordinary objects? On the margin - I would assume Array.empty to be static method to clean array. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Mark S. Miller
On Thu, Feb 19, 2015 at 12:56 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 19, 2015, at 12:09 PM, Andrea Giammarchi wrote: if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong with having these as we always had already: as prototypes? Just

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Jordan Harband
Does it not make sense anyways for Object.freeze on a RegExp instance to prohibit https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize from being called? `var regex = Object.freeze(/a/g); regex.compile('b', 'i');` should throw imo. On Thu, Feb 19, 2015 at 1:13 PM, Mark S.

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Kyle Simpson
I'm not writing to start or join a debate on the merits of using `Function.prototype` and `Array.prototype` in the aforementioned ways. I'm writing to confirm that they are in fact used, not just theoretically made up. I have been writing about and teaching for several years usage of

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Allen Wirfs-Brock
On Feb 19, 2015, at 1:13 PM, Mark S. Miller wrote: On Thu, Feb 19, 2015 at 12:56 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 19, 2015, at 12:09 PM, Andrea Giammarchi wrote: if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong

Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Allen Wirfs-Brock
On Feb 11, 2015, at 8:30 AM, Allen Wirfs-Brock wrote: TC39 members were aware that changing to using ordinary objects as the prototypes of the legacy built-ins was a breaking change (for example, it changes the prototypes {}.toString value). What we agreed to do was to make that change

RE: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Allen Wirfs-Brock This looks like the sort of evidence we asked for. I don't really think so. This is some tweets and books, not evidence of real-world usage that would break popular websites and cause browser game theory

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
not evidence of real-world usage that would break popular websites the Web is (still and thankfully) not about popular websites only. Using the `Array.prototype` instead of creating instances in the wild has been seen for long time, same way you don't do `{}.toString.call` but

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
I think I do understand ... is this operation valid in ES6 ? `var oneTwoThree = Array.prototype.concat(1, 2, 3); // [1, 2, 3]` 'cause that was the initial concern, and as far as I understand that will break. Or does it? On Thu, Feb 19, 2015 at 4:59 PM, Domenic Denicola d...@domenic.me wrote:

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Allen Wirfs-Brock
On Feb 19, 2015, at 9:01 AM, Andrea Giammarchi wrote: I think I do understand ... is this operation valid in ES6 ? `var oneTwoThree = Array.prototype.concat(1, 2, 3); // [1, 2, 3]` you would get: [Array.prototype, 1, 2, 3] That's what convinced me. allen

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
I remember once upon a time double quotes meant explicit intent of exact match, t least in Google, IIRC, dunno when that good idea got lost. Yes, it's hard to find for exact matches but if you also check the reduce example, `Array.prototype` is simply passed around. Again, I don't know how much

RE: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Domenic Denicola
From: Andrea Giammarchi [mailto:andrea.giammar...@gmail.com] Can we have either a list of these changes (I'm sure I've missed many, like this one, for example) https://people.mozilla.org/~jorendorff/es6-draft.html#sec-in-the-6th-edition ___

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
Annex E ... I've never reached that part ... Thanks! On Thu, Feb 19, 2015 at 5:42 PM, Domenic Denicola d...@domenic.me wrote: From: Andrea Giammarchi [mailto:andrea.giammar...@gmail.com] Can we have either a list of these changes (I'm sure I've missed many, like this one, for example)

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Mark S. Miller
1) The ES6 class pattern makes abstractions whose .prototype is an ordinary object. This change makes the builtin abstractions more consistent with class-based abstractions, minimizing surprise for future JS programmers who learn the language at ES6 or later. 2) From a security perspective, the

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Kyle Simpson
Just curious… for RegExp, Date, String and the others that *are* changing to plain objects… does that mean `Object.prototype.toString.call( .. )` will return [object Object] on them? Sorry, I've kinda gotten lost on what the default @@toStringTag behavior is going to be here.