July 25, 2012 - TC39 Meeting Notes

David Bruant bruant.d at gmail.com
Mon Jul 30 13:25:31 PDT 2012


Le 28/07/2012 21:04, Allen Wirfs-Brock a écrit :
> (...)
> We introduce a new operator that is looks like  :=
>
> This is the "define properties" operator.  Both the LHS and RHS must 
> be objects (or ToObject convertible).  Its semantics is to 
> [[DefineOwnProperty]] on the LHS obj a property corresponding to each 
> RHS own property.  I does this with all reflectable own properties. It 
> includes non-enumerable properties and unique named properties but not 
> non-reflectable /private/ name properties.  It rebinds methods with 
> super bindings to the RHS to new methods that are super bound to the LHS.
>
> The above example would then be written as:
>
> a := {
>   push(elem) {
>     ...
>   }
> };
> rather than, perhaps incorrectly as:
>
> a.push = function (elem) {
>     ...
> };
>
> or, correctly but very inconveniently as:
>
> Object.defineProperty(a, "push", {writable: true, configurable: true, 
> enumberable: true,
>     data:function (elem) {
I see the typo here ('data' instead of 'value') as one of the most 
brilliant and unexpected example of this inconvenience :-)
And I'm not even talking about 'enumberable' which I also trip over 
almost all the time to the point of making this syntax (en)um-bearable!

>         ...
>         }
>     }
> );
>
> (...)
>
> I really think in a language where we have both [[Put]] and 
> [[DefineOwnProperty]] semantics that we really need both = and :=
That's an interesting view on things. To me, it would make acceptable 
the idea of = being unreliable locally without prior knowledge (which, 
as noted, kind-of-already-is because of inherited setters) while := 
(which is more ':={}' actually, aka big-lips-guy) enables reliable local 
review without prior knowledge, proxy pathological cases aside.

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


More information about the es-discuss mailing list