IsConstructor
C. Scott Ananian
ecmascript at cscott.net
Wed Jun 11 09:50:39 PDT 2014
On Wed, Jun 11, 2014 at 12:44 PM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
> Array.from and Array.of have a non-throwing IsConstrutor test because they are designed to allow things like this:
>
> let of = Array.of;
> of(1,2,3,4,5); //Equivalent to: Array.of(1,2,3,4,5)
>
> I don't recall why we provided that functionality. It doesn't seem to me like a pattern we should want to encourage.
Why not just require:
```javascript
let of = Array.of.bind(Array);
of(1,2,3,4,5);
```
That seems like it would work just as well, and not require special
handling in the spec.
> I'd be happy to eliminate the special handling in Array.of and Array.from if there is consensus that it isn't desirable.
I don't need it. (Although `es6-shim` currently seems to implement
the special handling correctly.)
--scott
More information about the es-discuss
mailing list