Function.prototype, [[Call]] and [[Construct]]

Garrett Smith dhtmlkitchen at gmail.com
Mon Nov 9 21:10:22 PST 2009


On Mon, Nov 9, 2009 at 8:05 PM, Juriy Zaytsev <kangax.dev at gmail.com> wrote:
> On Nov 9, 2009, at 6:50 PM, Garrett Smith wrote:
>
>> [[Construct]] of Function.prototype is not standardized.
>>

[...]

>
> If you look into Section 15 — Native ECMAScript Objects, you'll see this
> rather clear explanation:
>
> "[...] None of the built-in functions described in this section shall
> implement the internal [[Construct]] method unless otherwise specified in
> the description of a particular function. None of the built-in functions
> described in this section shall initially have a prototype property unless
> otherwise specified in the description of a particular function. [...]"
>

That's pretty clear. I had interpreted that as meaning the global
functions (eval, parseInt), but now I see that that text applies to
the whole section 15, not just the function properties (as I had
misread it).

> In fact, I mentioned this exact phrase when writing about bugs in various
> browsers, revealed through Sputniktests web runner
> (http://thinkweb2.com/projects/prototype/sputniktests-web-runner/#construct-and-prototype-of-builtins).
>
> And as I said in a post, Firefox and Chrome, for example, fail a whole bunch
> of tests due to most of built-in methods (like `Array.prototype.toString`,
> `parseInt` or `String.prototype.slice`) implementing [[Construct]] and
> having .prototype properties.
>

So Function.prototype should not implement [[Construct]].

Garrett


More information about the es-discuss mailing list