A new ES6 draft is available
Fabrício Matté
ultcombo at gmail.com
Sat Jan 17 11:10:16 PST 2015
For a short term solution, I would suggest `arguments.new.target`.
The `arguments` object already contains info about how the function was
called (its arguments, the deprecated/obsolete `callee` and
obsolete/never-spec'd `caller` properties), so adding information about how
the function was called (whether it was `new`'ed) to `arguments` would make
sense imo.
For the long term, I'd like to see a new identifier injected into function
scopes which exposes the Lexical Environment/Environment Record internals.
Then we can use `__scope__.new.target` or `Reflect.isNewed(__scope__)` (or
`isConstructed`, which may make more sense seeing as there will be
`Reflect.construct`).
Of course, this `__scope__` binding should only be injected in the
Environment Record if the binding does not exist yet after registering the
function body's declarations, for back-compat reasons.
And obviously, `__scope` is just a placeholder name for this suggestion, I
don't really mind how it will be called.
/fm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150117/2261e464/attachment.html>
More information about the es-discuss
mailing list