Changes to apply/call this coercion
david.hopwood at industrial-designers.co.uk
Mon Oct 27 18:49:37 PDT 2008
Mark S. Miller wrote:
> [...] The *intent* is the following:
> * All the coercions of the this-value that were scattered all over the
> spec, including in the apply and call language, be removed.
> This-arguments become this-values with no coercion.
> * When a function is called as a function, the implicit this-value
> provided is |undefined|.
> * A non-strict function's [[Call]] method (rather than it's |call| or
> |apply| methods) coerce the this-value on entry to preserve ES3
> semantics. Since the time of coercion is unobservable (the coercion
> has no observable side effects), the intended result is no observable
> difference for non-strict functions. The non-strict this-coercions
> ** null -> global object
> ** undefined -> global object
> ** primitives -> wrappers (via ToObject)
> * Strict functions don't coerce their this-value at all. If your |f|
> and |g| functions were strict, then your test case must indeed fail.
> But if they're non-strict, your test case must pass
Ah, OK. This is all fine from a security point of view (the secure
subsets will enforce strict mode).
More information about the Es-discuss