As you've all pointed out, it's not "just sugar" in the sense that you couldn't do it in ES5; it's more that parallel syntax and API were created for the new functionality in ES6. Thanks for providing clear code examples of how one might extend builtins without `class`.
@kai: yes, extending builtins makes sense, in that it's an important part of ES6. Invoking "the web" doesn't negate *any* of the features of the language, new or old. Separately, not every web use involves any JSON serialization in either direction. On Tue, Jul 24, 2018 at 12:15 AM, T.J. Crowder < tj.crow...@farsightsoftware.com> wrote: > On Tue, Jul 24, 2018 at 8:00 AM, Michael Theriot > <michael.lee.ther...@gmail.com> wrote: > > `Reflect.construct` allows subclasses to obtain internal slots without > > `super()` / class syntax. > > Indeed, Darien pointed that out as well (and if you two hadn't, I would > have. :-) > > > This is the first I have heard `class` is anything but sugar. > > The accurate statement would be that `class` lets you do things you > couldn't do in ES5. But so does `Reflect.construct`. I believe it was > important to the "no `new`" crowd that a non-`class` mechanism existed for > creating objects using Error and Array as prototypes. > > -- T.J. Crowder >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss