Proposal: Object.defineProperty shorthand

Axel Rauschmayer axel at rauschma.de
Tue May 31 15:47:25 PDT 2011


> From: Brendan Eich <brendan at mozilla.com>
> 
> A Unix-y (ls(1) inspired) mid-point might be to use strings:
> 
> var foo = {
>   {"!c!e!w"} high_integrity: 42,
>   ...
> };
> 


Would it make sense to turn this into a generic system for adding meta-data to properties? Python’s decorators and Java’s annotations come to mind which are used for various great purposes in libraries. Some of Java’s annotations such @Override or @Nullable also cross the border into language territory.

Won’t enumerable go away (as in “used less”) in the long run? Thus there is less of a reason to provide a concise syntax for specifying enumerability.

I would prefer something like

var foo = {
  { !conf !enum !write } high_integrity: 42,
  ...
};

Yes, it is more verbose, but also more descriptive.

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



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


More information about the es-discuss mailing list