shortcuts for defining block-local private names, plays nicely with @foo syntax

Axel Rauschmayer axel at rauschma.de
Mon Jan 23 04:14:27 PST 2012


On Jan 23, 2012, at 12:21 , Herby Vojčík wrote:

> Allen Wirfs-Brock wrote:
>> I plan on proposing at the next TC39 meeting that we support .@ member
>> accesses and that we replace the use of [expr ] to define private named
>> properties in object literals (
>> http://wiki.ecmascript.org/doku.php?id=harmony:object_literals#object_literal_computed_property_keys
>> ) with @identifier to define such properties.
> 
> +1 for adding @foo:x to literals.
> Not needing to remove [expr]:x, though.

Hopefully, [] will become a full application data domain construct [1][2] (and exclusively so). Then it makes no sense in object literals.

However, @ could completely take over the program definition domain role of []:
1. Allow @ for both strings and name objects
2. Use @(expr) for property access via a computed name

However, with built-in maps, I’m not sure how frequent the use cases for #1 and #2 will be. Object.getProperty(key) might be enough.

[1] http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation
[2] http://www.2ality.com/2012/01/roles-objects-arrays.html

-- 
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/20120123/316288e2/attachment-0001.html>


More information about the es-discuss mailing list