Classes are specified to have an immutable inner binding even if they
also declare a mutable lexical binding in the enclosing scope:

    class Foo {
        foo() {
            // immutable inner binding 'Foo' is in scope here
        }
    }
    // mutable lexical binding 'Foo' is in scope here

Having two bindings can be tricky. Suppose I then do this:

    Foo = wrapConstructorWithExtraLogging(Foo);

Now the two bindings have different values. If one of Foo's methods
does `new Foo`, we don't get the extra logging.

Can we go back to having classes do what functions do? A single
function never introduces two bindings; rather a named function
expression has only the immutable inner binding and a function
declaration only declares a variable.

-j
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to