||= is much needed?

John Tamplin jat at google.com
Thu Jun 14 14:38:30 PDT 2012


On Thu, Jun 14, 2012 at 5:32 PM, T.J. Crowder <tj at crowdersoftware.com>wrote:

>
>> Is ||= really worth it? It would not assign if the left side is truthy,
>> but perhaps no one will mind.
>>
>
> Nice-to-have. The fact it doesn't assign if the left side is truthy is the
> only reason for having it, surely?
>

Plus not even evaluating the RHS if the LHS is truthy -- useful if the
default is an expensive calculation.

-- 
John A. Tamplin
Software Engineer (GWT), Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120614/052affd9/attachment.html>


More information about the es-discuss mailing list