Issue when subclassing a bound function used as constructor

Claude Pache claude.pache at gmail.com
Thu Jun 26 09:57:39 PDT 2014


    let C be some constructor
    let D = C.bind(obj, a, b)

Thanks to the carefully designed `D.[[Construct]]` internal method, the following expressions are equivalent:

    new D(...args)
    new C(a, b, ...args)

Consider now:

    class E extends D {
        contructor(...args) {
            super(...args)
        }
    }

As I understand, `super(...args)` calls `D.[[Call]](this, args)`, which in turn calls `C.[[Call]](obj, [a, b, ...args])`. But what we probably want here, is  `C.[[Call]](this, [a, b, ...args])`.

I am missing something or is there an issue?

—Claude

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140626/b0ce02f5/attachment.html>


More information about the es-discuss mailing list