Class double-bind

Kevin Smith zenparsing at gmail.com
Thu Mar 5 17:20:03 UTC 2015


>
> However, the double-binding issue makes this weirder. If non-const-class
> declarations were like non-const-function declarations, where there is only
> one binding per defining occurrence, then I would fully agree. But this
> issue of one defining occurrence creating two bindings that can diverge is
> a new level of unpleasantness. I agree this calls for the issue to be fixed
> now in ES6 if we can, for non-const-classes.
>

OK - I see.  So on one side (double-binding) the risk is that someone will
change the outer binding and violate an implicit assumption that references
inside the class body and outside point to the same thing.  On the other
side, the risk is that we disable hackery like:

    class C {}
    if (someCondition) {
     C = class OtherC {};
    }

But you can always write the above as:

    let C = class {};
    if (someCondition) {
     C = class OtherC {};
    }

I think you've sold me.  I'm worried that there might be other
hacker-use-cases that I'm not considering, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150305/8f06c482/attachment.html>


More information about the es-discuss mailing list