IsConstructor
Allen Wirfs-Brock
allen at wirfs-brock.com
Wed Jun 11 13:04:15 PDT 2014
On Jun 11, 2014, at 11:59 AM, Rick Waldron wrote:
>
>
>
> On Wed, Jun 11, 2014 at 1:37 PM, Domenic Denicola <domenic at domenicdenicola.com> wrote:
> It's also deceptive: it makes you think `Array.of` and `Array.from` are functions, when in reality they are definitely methods.
>
> Yes, you're right.
>
>
> What about Array subclasses? `from` and `of` are "inherited" when Array is subclassed, so these:
>
> 22.1.2.3 4 & 5 (http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.of)
> 22.1.2.1 8.a & 8.b (http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from)
> 22.1.2.1 13 & 14
>
> Which are are how `from` and `of` determine what to construct, will be replaced with a single step, being one of:
>
> Let A be the result of calling the [[Construct]] internal method of C with an empty argument list.
> Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
>
> But surely this step will also have to be guarded by IsCallable(this), which that means this:
>
> If IsConstructor(C) is true, then
> Let A be the result of calling the [[Construct]] internal method of C with an empty argument list.
> Else,
> Let A be ArrayCreate(0).
>
> Becomes:
>
> If IsCallable(C) is true, then
that's not an adequate guard, be an object can be callable but not have a [[Construct]] internal method so the next step not be valid
> Let A be the result of calling the [[Construct]] internal method of C with an empty argument list.
> Else,
> Let A be ArrayCreate(0).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140611/e085954e/attachment.html>
More information about the es-discuss
mailing list