callable objects ?
brendan at mozilla.org
Tue Apr 17 14:46:21 PDT 2012
Already specified by ES6 as patched by my mail ;-).
There's no fallback on @call from missing @construct. You have to say
what you mean. If you define @call and someone uses 'new', without an
inherited @construct you get a TypeError per 11.2.2 "The new Operator".
Russell Leggett wrote:
> What would happen if the object only defined one of these, but was
> used with the wrong one? Let's say I create an object Foo with @call,
> but not @construct, and then said new Foo()? Would it use @call and
> result in an error? What about vice versa?
More information about the es-discuss