custom proto arg for Proxy.createFunction?
brendan at mozilla.com
Fri Feb 25 06:05:33 PST 2011
On Feb 25, 2011, at 5:41 AM, Lasse Reichstein wrote:
> As long as __proto__ is writable, that can be changed later anyway.
> If we get rid of writable __proto__, then it would be an invariant.
We will work to get rid of writable __proto__ and then __proto__ altogether, but that will take time and require browser vendor cooperation.
Anyway, __proto__ is non-standard so let's turn a blind eye to it.
> I'm not sure why it's important that all Callable objects need to have
> Function.prototype in their prototype chain, though.
The core language invariants, per ES5, include:
typeof x == "function => x() <=> x.call(undefined)
provided x is a native object. If x refers to a host object, .call may not be Function.prototype.call or a workalike.
It turns out in "JS in reality", with multiple global objects and also (independently) due to host objects, this invariant varies.
So perhaps it is not "important", but spec invariants often are. Consider
typeof x == typeof y && x == y <=> x === y
(That one, I believe all engines uphold.)
We hope to extend the spec to cover "reality" over time, while reforming "reality" to uphold spec invariants if we can. This is one reason we do not spec all of "reality" -- we want to turn a blind spec-eye while working with implementors to deprecate and reform.
More information about the es-discuss