Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Claude Pache
Iterables are useful not only in for/of loops but also in otherwise polyfillable constructs; for example, in the Set constructor: // Let `a` be a Set object b = new Set(a) // copy the elements of `a` into a new Set Question: Will there be a standard way for obtaining the @@iterator

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Jason Orendorff
On Tue, Jun 25, 2013 at 9:36 PM, Brandon Benvie bben...@mozilla.com wrote: I think that the iteration protocol falls under the type of thing that is better exposed through this layer of faux-stratification rather than completely unstratified, due to its primary use in supporting syntax

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Dean Landolt
On Wed, Jun 26, 2013 at 6:23 AM, Claude Pache claude.pa...@gmail.comwrote: Iterables are useful not only in for/of loops but also in otherwise polyfillable constructs; for example, in the Set constructor: // Let `a` be a Set object b = new Set(a) // copy the elements of `a` into a

RE: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Domenic Denicola
From: Claude Pache implement/polyfill the iteration protocol in both old and new environments, using `GetIteratorSymbol()` where @@iterator is needed. If that `GetIteratorSymbol()` function is readily available in a standard place, it will allow different libraries to cooperate. I think

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Dean Landolt
On Wed, Jun 26, 2013 at 9:38 AM, Jason Orendorff jason.orendo...@gmail.comwrote: On Tue, Jun 25, 2013 at 9:36 PM, Brandon Benvie bben...@mozilla.com wrote: I think that the iteration protocol falls under the type of thing that is better exposed through this layer of faux-stratification

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Jason Orendorff
On Wed, Jun 26, 2013 at 10:20 AM, Dean Landolt d...@deanlandolt.com wrote: I assume the primary reason to hang the iterator reference directly off an object is so that it can be prototypally overloaded -- would you agree? Sure. Polymorphism, therefore a method. Given that library code tends

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Dean Landolt
On Wed, Jun 26, 2013 at 12:15 PM, Jason Orendorff jason.orendo...@gmail.com wrote: On Wed, Jun 26, 2013 at 10:20 AM, Dean Landolt d...@deanlandolt.com wrote: I assume the primary reason to hang the iterator reference directly off an object is so that it can be prototypally overloaded --

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Brendan Eich
Dean Landolt wrote: sometimes it can fail in a way where you may want to proceed up the prototype chain (or do something else). This is where I believe there are interop landmines buried. How is this different from toString? /be ___ es-discuss

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Dean Landolt
On Wed, Jun 26, 2013 at 1:31 PM, Brendan Eich bren...@mozilla.com wrote: Dean Landolt wrote: sometimes it can fail in a way where you may want to proceed up the prototype chain (or do something else). This is where I believe there are interop landmines buried. How is this different from

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Jason Orendorff
On Wed, Jun 26, 2013 at 12:15 PM, Dean Landolt d...@deanlandolt.com wrote: On Wed, Jun 26, 2013 at 12:15 PM, Jason Orendorff jason.orendo...@gmail.com wrote: If we make the name just plain iterator, there's a conventional right answer for this: `typeof obj.iterator === function`. Yes -- my

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Jason Orendorff
On Wed, Jun 26, 2013 at 5:10 PM, Jason Orendorff jason.orendo...@gmail.com wrote: If JS were being designed green-field today, maybe some of us would make array.length a symbol, not because it's meta (meaning, it is used by some key builtins, notably including Function.prototype.apply) and not

RE: Array.prototype.values() compatibility hazard

2013-06-26 Thread Brian Terlson
I have a dataset of scripts downloaded from the top 10k websites by traffic according to Alexa. These scripts are static only, and from page-load only, so take this information with the appropriate amount of salt. I searched for occurrences of the identifiers keys, values, or entries inside

Module loader dependency trees

2013-06-26 Thread Guy Bedford
Hi, One very useful feature in RequireJS is the ability to hook into the dependency tree through the onResourceLoad API. Currently, the way the link function is designed for ES6 modules, there is no way for a loader to discover the imports for a given module. If there was some way to allow some

Re: Array.prototype.values() compatibility hazard

2013-06-26 Thread Brendan Eich
Excellent, great work. From private correspondence with Sencha, it seems they may be able to avoid the problem without too much trouble. Still, a bitter stab in the back from 'with'! And cautionary for future method additions (not that I propose mangled or unlikely names). /be Brian Terlson

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Dean Landolt
On Wed, Jun 26, 2013 at 6:10 PM, Jason Orendorff jason.orendo...@gmail.comwrote: On Wed, Jun 26, 2013 at 12:15 PM, Dean Landolt d...@deanlandolt.com wrote: On Wed, Jun 26, 2013 at 12:15 PM, Jason Orendorff jason.orendo...@gmail.com wrote: If we make the name just plain iterator, there's a