On Jun 20, 2011, at 3:43 AM, Axel Rauschmayer wrote:

> Would it make sense to include a shorthand for calling 
> Object.defineProperty() to object literals?
> 
> Possible benefits:
> - Extensible, should other property attributes come up in the future
> - Descriptive
> - Might obviate the need to have a shorthand for "enumerable" (I usually 
> ignore it and can’t think of any use cases)
> 
> === Example ===
> 
> var Multiplier = {
>    FACTOR :: { value: 3, writable: false },

Do not use :: -- it is wanted for 
http://wiki.ecmascript.org/doku.php?id=strawman:guards (and used previously in 
E4X, ECMA-357).

Allen presented new syntax roughly as verbose at the March TC39 meeting. 
General reaction was "too verbose".

Wherefore the #!~ prefixes idea, now in 
http://wiki.ecmascript.org/doku.php?id=harmony:object_literals -- the syntax 
there is definitely not final, BTW, but something like it is needed. I've 
argued we shouldn't try to be "half-verbose", and since ES5 has the very 
verbose functional API, object initialisers probably will go the other way.

/be

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to