||= is much needed?

Brendan Eich brendan at mozilla.org
Tue Jun 12 15:17:58 PDT 2012


Updated. Sorry, no ||| instead of ??. Instead, inspired by Wes's GCC 
reminder, I kept the ?? operator but re-spelled it as ?: and made ??= be 
spelled ?=.

http://wiki.ecmascript.org/doku.php?id=strawman:default_operator

The semantics match only undefined. APIs use null as no-object and do 
not want to trigger defaulting, here or with parameter default values.

This reminds me: IIRC we need to agree that an explicit undefined actual 
argument triggers defaulting for parameter default values (as it would 
if the pdv-based code were rewritten to use ?: or ?=).

/be

Brendan Eich wrote:
> Brendan Eich wrote:
>> LeftHandSideExpression ?= AssignmentExpression
>>
>> are roughly
>>
>> Let lref = evaluate A.
>> Let lval = GetValue(lref).
>> Let rref = evaluate B. 
>
> Of course, A should be LeftHandSideExpression and B should be 
> AssignmentExpression.
>
> This is pretty simple. We could even grant an exception and get it 
> into ES6, IMHO. But first it needs a strawman and some discussion.
>
> Absent fast objections here, I'll co-opt the
>
> http://wiki.ecmascript.org/doku.php?id=strawman:default_operator
>
> strawman and put it on the agenda.
>
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list