I filed one on us: https://code.google.com/p/v8/issues/detail?id=4087
On Thu, May 7, 2015 at 4:25 PM Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:
>
> On May 7, 2015, at 12:50 PM, Francisco Tolmasky wrote:
>
> > In the existing implementations I’ve tried, it appears I can’t do this:
> >
> > class SuperFunction extends Function { }
> >
> > (also tried with constructor(str) { super(str) })
> >
> > It “works”, but the resulting new SuperFunction(“return 5”) is just a
> Function, not a SuperFunction. Is Function meants to be an exception to the
> subclassing built-ins, or should it also work?
>
> Nope, it's supposed to work. `Object.getPrototypeOf(new SuperFunction("")`
> should be SuperFunction.prototype and `new SuperFunction("") instanceof
> SuperFunction` should be true.
>
> You need to file a bug report on the implementations where you tried it.
> Sounds like they still have some work to do
>
> Allen
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150507/ebab5ad8/attachment-0001.html>
d at domenic.me (2015-05-14T17:20:13.071Z)
I filed one on us: https://code.google.com/p/v8/issues/detail?id=4087
I filed one on us: https://code.google.com/p/v8/issues/detail?id=4087 On Thu, May 7, 2015 at 4:25 PM Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > > On May 7, 2015, at 12:50 PM, Francisco Tolmasky wrote: > > > In the existing implementations I’ve tried, it appears I can’t do this: > > > > class SuperFunction extends Function { } > > > > (also tried with constructor(str) { super(str) }) > > > > It “works”, but the resulting new SuperFunction(“return 5”) is just a > Function, not a SuperFunction. Is Function meants to be an exception to the > subclassing built-ins, or should it also work? > > Nope, it's supposed to work. `Object.getPrototypeOf(new SuperFunction("")` > should be SuperFunction.prototype and `new SuperFunction("") instanceof > SuperFunction` should be true. > > You need to file a bug report on the implementations where you tried it. > Sounds like they still have some work to do > > Allen > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150507/ebab5ad8/attachment-0001.html>