On 14 June 2012 22:38, John Tamplin <[email protected]> wrote: > On Thu, Jun 14, 2012 at 5:32 PM, T.J. Crowder <[email protected]>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. >
Right, but `a = a || b` doesn't evaluate `b` if `a` is truthy, either. What I meant was, if we have `a ??= b`, and of course we already have `a = a || b`, the only reason for having `a ||= b` is that it doesn't assign if `a` is truthy. -- T.J.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

