Coercing 'this' (was: Topic list - pending changes and issues for the ES3.1 spec)
Mark S. Miller
erights at google.com
Mon Sep 15 19:53:34 PDT 2008
On Mon, Sep 15, 2008 at 7:28 PM, David-Sarah Hopwood <
david.hopwood at industrial-designers.co.uk> wrote:
> > Agreed that this proposal does not prevent this existing confusion.
> > does it make it worse. If there's something we can plausibly do to fix
> > I'd love to! Any suggestions?
> The problem here is the lack of any run-time type distinction between
> constructors and other functions. I don't see how to fix the existing
> confusion in a compatible way. However, when we add the class feature in
> ES-Harmony, we should avoid making it worse by using a desugaring that
> allows the class name to be used with 'new', but prevents any use as a
> function from breaking object encapsulation.
The desugaring I presented in "Look ma, no 'this'" does so, precisely
because it avoids 'this'.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es-discuss