strawman for the := operator

Rick Waldron waldron.rick at gmail.com
Wed Aug 8 09:33:03 PDT 2012


On Wed, Aug 8, 2012 at 11:12 AM, Herby Vojčík <herby at mailbox.sk> wrote:

> Thanks.
>
> 1. It has lot of typos (I remember two uses of := in examples in the first
> half where in fact legacy = should have been plus there are a few others,
> it would benefit from proofreading with someone with editing access).
>

I saw and fixed this about an hour ago - thanks!


>
> 2. As was already mentioned, the super rebinding allows me to just
>
>   iWantSuperHere := (class { m(...) {super....} }).prototype;
>
> to get to generic super, but spec's lack of genericity must be worked
> around this way (or similar). Which is probably different discussion (and
> with this := around but with super still restricted to classes it would
> look strange or maybe even ridiculous).
>
> Herby
>
> Allen Wirfs-Brock 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<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
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120808/1bd89aa8/attachment.html>


More information about the es-discuss mailing list