Russell Leggett wrote:
On Tue, Jun 12, 2012 at 2:31 PM, Tom Ellis <[email protected] <mailto:[email protected]>> wrote:

    I like the sound of ?= too.

    var a;

    //later on

    a ?= 15;

    It goes with all the other operators that are out there too (!=,
    =, ==, === etc).


+1, useful and intuitive.

And (to be clear) the semantics for

LeftHandSideExpression ?= AssignmentExpression

are roughly

Let lref = evaluate A.
Let lval = GetValue(lref).
Let rref = evaluate B.
Let rval = GetValue(rref).
Throw a SyntaxError exception if the following conditions are all true:
• Type(lref) is Reference is true
• IsStrictReference(lref) is true
• Type(GetBase(lref)) is Environment Record
• GetReferencedName(lref) is either "eval" or "arguments"
If lval is undefined, call PutValue(lref, rval).

to assign the default value if and only if the left-hand side's current value is undefined.

/be

- Russ


    Tom

    On 12 Jun 2012, at 19:04, Brendan Eich wrote:

    > Brendan Eich wrote:
    >> Is this (A ? B) ? C : D or A ? (B ? C) : D. We can disambiguate
    in the formal grammar but readers may rebel.
    >
    > Or A ? (B ? C : D), of course.
    >
    > Just say no to lone ? as new operator. I'm warming up to ?= though!
    >
    > /be
    > _______________________________________________
    > es-discuss mailing list
    > [email protected] <mailto:[email protected]>
    > https://mail.mozilla.org/listinfo/es-discuss

    _______________________________________________
    es-discuss mailing list
    [email protected] <mailto:[email protected]>
    https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
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

Reply via email to