||= is much needed?

David Bruant bruant.d at gmail.com
Tue Jun 12 07:33:45 PDT 2012


Le 12/06/2012 15:27, Hemanth H.M a écrit :
> Would something like :
>
> |obj["prop"] ||= "NewProp"|
>
> be useful?
ahah, I asked the same question very recently [1]. Answer by Brendan 
Eich [2].
I definitely agree that default arguments are a decent alternative. I 
can't recall examples where it wouldn't be enough. Do you have use cases 
where you would use ||= and default argument values couldn't be used?

David

[1] https://twitter.com/DavidBruant/status/210654806732324864
[2] https://twitter.com/BrendanEich/status/210750515808706561
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120612/c5c54b44/attachment.html>


More information about the es-discuss mailing list