proposal: Object Members
Ranando King
kingmph at gmail.com
Tue Jul 24 16:12:20 UTC 2018
Since it seems to be such an inflammatory statement, I have removed most of
the comments that infer the sugar-like nature of `class` from my proposal.
It counterproductive to get stuck on whether or not `class` is syntactic
sugar when the point is supposed to be about how to extend the language
features around the `class` keyword.
On Tue, Jul 24, 2018 at 9:14 AM Ranando King <kingmph at gmail.com> wrote:
> @ljharb: It seems you now understand what I was trying to say. Sadly, I'm
> not always the most eloquent.
>
> > 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.
>
> The intent of my proposal is to provide both member fields and privilege
> levels to the `class` keyword, and the equivalent for object literals in a
> way that meets with both an intuitive declaration style, and a reasonable
> access notation that breaks as little as few as possible of the developers
> expectations of what can and can't be done.
>
> On Tue, Jul 24, 2018 at 3:18 AM Jordan Harband <ljharb at gmail.com> wrote:
>
>> 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.crowder at farsightsoftware.com> wrote:
>>
>>> On Tue, Jul 24, 2018 at 8:00 AM, Michael Theriot
>>> <michael.lee.theriot at 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 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/20180724/47cd9648/attachment-0001.html>
More information about the es-discuss
mailing list