{x,Y} is syntactic shorthand for {x:x, y:y}
See http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_shorthand
On Aug 8, 2012, at 3:42 AM, Erik Corry wrote:
> From the straw man:
>
> class Point {
> constructor(x,y) {
> this := {x,y} //define and initialize x and y properties of new object
> }
> }
>
> should this read:
>
> this := {x: x, y: y}
>
> ?
>
> On 7 August 2012 00:44, Allen Wirfs-Brock <[email protected]> wrote:
>> Based upon discussions last week in the "July 25, 2012 - TC39 Meeting Notes"
>> thread, I've created a new strawman proposal for a := operator. See
>> http://wiki.ecmascript.org/doku.php?id=strawman:define_properties_operator
>>
>> := is a convient way to copy properties from one object to another or to
>> extend an object with new properties. It combines supports for many of the
>> same use cases as the previously proposed "object extension literals" and
>> the JSFixed Object.extend proposal.
>>
>> The most important characteristic of := is that it uses
>> [[DefineOwnProperty]] semantics rather than [[Put]] semantics to define
>> properties on its target object so it doesn't run into issues with
>> assignment to accessor properties or over-riding inherited readonly
>> properties. It is also smart about dealing with methods that reference
>> super.
>>
>> Some basic examples:
>>
>> target := src; //define all own properties of src onto target
>>
>> //add a method and an accessor to an existing prototype
>> Point.prototype := {
>> plus(aPoint) {return new
>> this.comstructor(this.x+aPoint.x,this.y+aPoint.y},
>> get rho() {return Math.sqrt(this.x*this.x+this.y*this.y}
>> };
>>
>>
>> Have at it,
>>
>> Allen
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss