Would "an array-like with a negative length field" read better in ecmaspeak? I'm talking about the value *before* ToLength is invoked. `Array.prototype.slice.call(3)` and `Array.prototype.slice.call({length:-1})` both complete successfully (and return the same value), due to the soothing effect of `ToLength`. My informal definition for "array-like" is "something which is not actually an Array but which will not throw an error when used as the receiver in an invocation of a generic method of Array", so both `3` and `{length:-1}` are "array-like" under my definition, and then I need a way to describe the difference between them. I believe you are saying they are both "array-likes with zero length", since that's the result of ToLength. But perhaps you wouldn't call them "array-like" at all? --scott On Feb 14, 2014 3:12 PM, "Claude Pache" <claude.pa...@gmail.com> wrote:
> > > > Le 14 févr. 2014 à 23:40, "C. Scott Ananian" <ecmascr...@cscott.net> a > écrit : > > > > Claude Pache wrote: > >> "Array-likes with negative length" doesn't make sense. > > > > `Array.prototype.copyWithin.call({ length: -1 }, ... );` > > > > Call it whatever you like, although I'm always interested in learning > > new phrases of ECMAspeak (if there's an appropriate name for this). > > --scott > > Since you are interested: "The abstract operation ToLength converts its > argument to an integer suitable for use as the length of an array-like > object." [1] > > It doesn't really matter whether ToLength could extract a reasonable value > for an unreasonable object, or not. But consistency is important: note that > this operation is used whenever the length of an arraylike is expected, not > only for default arguments. > > [1] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength > > —Claude > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss