usable enough private names (was: Re: Using Object Literals as Classes)

Axel Rauschmayer axel at rauschma.de
Sat Mar 17 00:23:32 PDT 2012


That makes sense.

One thing to look out for: Not loosing one’s mind due to subtle syntactic differences between modules, class declarations and object initializers (and possibly cascades). There needs to be consistency. But (implicit) rules such as “colon => separator is comma” and “equals => separator is semicolon” should make that OK.

On Mar 17, 2012, at 8:14 , Brendan Eich wrote:

> Axel Rauschmayer wrote:
>> private x,y; is syntactically tricky inside an object initializer. The previous consensus was to use
>>      private { x, y }
> 
> I don't like object literal syntax, it takes over like a weed. If classes are worth adding with higher-level (but still desugarable) semantics per yard of syntax, as I think Kevin's blog post in part argues for, then I continue to believe they'll need bespoke body-syntax -- neither object literal nor function (code).
> 
> Definitely we want sugar for
> 
>  const x = Name.create(), y = Name.create();
> 
> I don't see why, given the right class body syntax, that sugar could not be
> 
>  private x, y;
> 
> The old-ES4/JS2 idea of using {} for arbitrary distribution of a keyword over a list of declarators, as an alternative to C++ labeled sections, is not obviously needed. My fork of jashkenas's gist tried it out but I'm cool on it now.
> 
> /be
>> 
>> For example here:
>> https://gist.github.com/1332193 (Brendan’s class proposal)
>> https://gist.github.com/1336846 (my class proposal)
>> 
>> On Mar 16, 2012, at 22:24 , Domenic Denicola wrote:
>> 
>>> Yes, this looks pretty solid, although I can't remember seeing it anywhere.
>> 
> 

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120317/b1a976aa/attachment-0001.html>


More information about the es-discuss mailing list