Proposing a conditional assignment (or equals) operator

Bruno Jouhier bjouhier at gmail.com
Tue May 10 08:58:55 UTC 2016


A big +1.

A quick grep on our code base shows 3000+ occurrences of the x = x || y
idiom in 700+ files. This proposal would make this code more compact and
more efficient, as it avoids redundant assignments.

The x = x && y idiom is a lot less common: 150 occurrences only, and is
usually associated with questionable reuse of a polymorphic variable to
walk a chain. But it would seem logical to extend the proposal to &&=.

Bruno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160510/6ae5d545/attachment.html>


More information about the es-discuss mailing list