On Mar 8, 2013, at 4:15 PM, Brandon Benvie wrote: > ...
> Classes in general aren't straight transpilable to ES6. Not faithfully. Part > of their contract is that you can use them to extend builtins, for example. > I'm sure there are other little details as well. Actually, subclass built-ins isn't tied to using class declarations. It is more closely tied to extensions to the new operator (the default [[Construct]] internal method) so that JS code has more control over the allocation step via the @@create methods. You probably can't directly shim that but you could transpile it into equivalent semantics. You can also use Dunder proto and other hacka to hijack built-in array (and other exotic object) instances and return them from @@create methods with arbitrary [[Prototype]] values. Class declaration themselves don't really create any object structures that you can't create using ES5 techniques plus Dunder proto. One thing it does that you can't accomplish in ES5 is create functions (for methods) aren't constructable. Also supporting super would require a transpiler. Allen > It is possible to transpile all of ES6 to ES3 though if you're willing to > write a runtime and convert all operators to function calls that use the > runtime to implement the delta between ES6 and ES3. > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

