Determine if a value is Callable/Constructible
flannery.peter at ntlworld.com
Mon Mar 30 21:28:41 UTC 2015
I personally think it's better to have **harmony** between ES5 and ES6
classes and not incompatibility.
The web and the like are currently littered with applications that use
[[call]] as a sub classing technique and now all these apps will be
give a harsh choice, either disregard using ES6 class syntax,
completely overhaul to suit ES6 or just don't move to ES6 until
time\money budgets permit.
Is it not possible to:
1. Have a unified construct for both class and function syntax, i.e.
`SomeClass.constructor.call` can be used to sub class for both ES6 and
2. Instead of throwing the message `Class constructors cannot be
invoked without 'new'` **change it to become** `Class constructors
cannot be invoked without using 'new' or it's .constructor method`
3. Functions will continue to have [[call]] regardless but it should
still be recommended to use `SomeClass.constructor.call` for sub
classing for great compatibility
4. Polyfill vendors have their own spec for this scenario. i.e. when
the detect class syntax is used then mark the output ES5 prototype
with a [[class-tag]] that allows them to assert and throw the same
`Class constructors cannot be invoked.....` message as stated in point
More information about the es-discuss