Re: How would we copy an iterator?

2015-02-22 Thread Salvador de la Puente González
Hey Philip, you can see https://esdiscuss.org/topic/proposal-generator-clone-and-generator-goto for more about this topic. On Wed, Feb 18, 2015 at 2:02 PM, Philip Polkovnikov polkovnikov...@gmail.com wrote: - 1. Where is the function `run`? The function `run` is pretty classic variation on

Re: How would we copy an iterator?

2015-02-22 Thread Brendan Eich
As the comments from Tab Atkins and John Lenz there suggest, this is best done above the level of the standard, for now. If we need to roll up itertools including tee in ES7 (I am pretty sure we do), the best way to get there is via github -- not by prematurely standardizing APIs or

RE: Global method calls

2015-02-22 Thread Domenic Denicola
OK, I think I might be on the trail of this one. [1] indicates a plan to make [Global]-annotated objects, like the Window object, apply [ImplicitThis] behavior to the object's methods and the methods of anything that shows up in its prototype chain. [ImplicitThis] behavior is defined at [2],

Re: Global method calls

2015-02-22 Thread Mark Miller
There, Boris writes: Conceptually, using the global of the realm of the function involved (i.e. the Chrome/Firefox/IE10 behavior) makes sense to me. Me too. This is in keeping with the spirit of lexical scoping. It is as if these built-in functions have lexically captured the global of the

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 ___

*.empty Idea

2015-02-22 Thread Isiah Meadows
I really liked Jordan Harband's suggestion https://esdiscuss.org/topic/array-prototype-change-was-tostringtag-spoofing-for-null-and-undefined#content-12 of adding Array.empty, Function.empty, etc. to ES7. It is relatively easy to polyfill as well. ```js [Array, ArrayBuffer, Int8Array,

Re: *.empty Idea

2015-02-22 Thread Jordan Harband
I'd love to bring a proposal to the committee for this since it seems like there's interest. I suspect that even though some of the empties seem useless to some, somebody somewhere will find a use case, and consistency is useful (that everything that could have a concept of empty would have a

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

Global method calls

2015-02-22 Thread Domenic Denicola
(Cc'ing public-script-coord in case this answer gets more complicated in the presence of the window proxy/overriden this-in-global setup.) Given code like script addEventListener(foo, function () { }); /script Is this supposed to be an Invoke(current global, addEventListener,

Re: Global method calls

2015-02-22 Thread Mark Miller
On Sun, Feb 22, 2015 at 1:03 PM, Domenic Denicola d...@domenic.me wrote: (Cc'ing public-script-coord in case this answer gets more complicated in the presence of the window proxy/overriden this-in-global setup.) Given code like script addEventListener(foo, function () { });

Re: Global method calls

2015-02-22 Thread Mark Miller
https://heycam.github.io/webidl/#ImplicitThis says: If the [ImplicitThis] https://heycam.github.io/webidl/#ImplicitThis extended attribute https://heycam.github.io/webidl/#dfn-extended-attribute appears on an interface https://heycam.github.io/webidl/#dfn-interface, it indicates that when a

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: Global method calls

2015-02-22 Thread Domenic Denicola
Thanks Mark. At this point it may tend toward more of a public-script-coord question... From: Mark Miller [mailto:erig...@gmail.com] If it is strict code, then this is definitely a Call(addEventListener, undefined, foo, function () {}) I won't try to speak definitively for what happens if

RE: Global method calls

2015-02-22 Thread Domenic Denicola
From: Mark Miller [mailto:erig...@gmail.com] the ECMAScript global object? Which one? (Even if it is clear from context, please assume I do not have that context.) Heh; good catch. A contemporary thread to my [1] is

Re: Global method calls

2015-02-22 Thread Brendan Eich
Mark Miller wrote: There, Boris writes: Conceptually, using the global of the realm of the function involved (i.e. the Chrome/Firefox/IE10 behavior) makes sense to me. Me too. This is in keeping with the spirit of lexical scoping. It is as if these built-in functions have lexically captured

RE: short-circuiting Array.prototype.reduce

2015-02-22 Thread Domenic Denicola
My initial feedback is that this needs a lot more why in comparison to the how. The only inkling of why this might be useful is an unsourced assertion that it's done in Clojure, for unknown reasons. The example code isn't very compelling either; something more real-world would be good there.

Re: How would we copy an iterator?

2015-02-22 Thread Salvador de la Puente González
Yep. This was already discussed in the topic I mentioned before. Just to remember, the real problem with tee() is that the generators are not actually independent as you can not .send() different information to each one to make them diverge. So producing a real clone of the generator is not

short-circuiting Array.prototype.reduce

2015-02-22 Thread Lee Byron
Hey all, I’d like to propose an addition to ES7 to add @@reduced as a way to short-circuit from Array.prototype.reduce. I’ve written up a polyfill and explanation here: https://github.com/leebyron/ecma-reduced I would love your feedback on this. Lee

Re: short-circuiting Array.prototype.reduce

2015-02-22 Thread Dmitry Soshnikov
On Sun, Feb 22, 2015 at 10:11 PM, Domenic Denicola d...@domenic.me wrote: My initial feedback is that this needs a lot more why in comparison to the how. The technical reason for this I guess, is that JS doesn't have TCP blocks, that would allow you to stop iteration, and exit the `reduce`

Re: Global method calls

2015-02-22 Thread Boris Zbarsky
On 2/22/15 4:55 PM, Domenic Denicola wrote: [1] indicates a plan to make [Global]-annotated objects, like the Window object, apply [ImplicitThis] behavior to the object's methods and the methods of anything that shows up in its prototype chain. More like a proposal than a plan, sadly. One