logical-assignment operators

Brendan Eich brendan at mozilla.org
Tue Feb 13 10:14:33 PST 2007


On Feb 13, 2007, at 1:07 AM, Lars T Hansen wrote:

>>> Sure, but ^^ can't short-circuit, it's not in C, and maybe we can do
>>> without it. I've used (alpha == true) ^ ( bravo == true) and lived.
>>
>> That works when alpha and bravo are booleans, but not when they are
>> richer values.
>
> The use of == implies a rich set of conversions, so this probably
> works well most of the time.  But a proper definition of ^^ would  
> leave
> less to chance.

And can preserve the value of the operand that converts to true.

Still no short-circuiting, and it seems to lack use cases in  
everyone's experiences. Since it evaluates both operands, it can be  
written as a function, so TG1 in today's conference call decided to  
pass on ^^ and ^^=.

But the good news is that we agreed to support &&= and ||= -- which  
are in ActionScript 3 already.

/be




More information about the Es4-discuss mailing list