From: Phillip Gawlowski Date: 2008-05-02T06:59:36+09:00 Subject: Re: Please explain nuances of ||= -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David A. Black wrote: | Hi -- | | On Fri, 2 May 2008, Phillip Gawlowski wrote: | | Whoops -- sorry :-) As if. :P | I actually have a feeling we're talking at cross-purposes, and that | I'm somehow not getting something. All I'm saying is that h[x] ||= | value is the same as h[x] || h[x] = value, for any hash h and any key | x. That can be demonstrated easily (as Robert did) just by | substituting one expression for the other. It's an unusual case, but | it's legal. I'm not sure what would be needed beyond that to | demonstrate that x = x || y is not a drop-in replacement for x ||= y. Yeah, I'm taking the Bird's Eye View on it all, essentially saying: 'it works like this almost always, but Hash is a special case, since it has default values [or whatever the implementation detail is, that makes Hash work differently]). - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan Blog: http://justarubyist.blogspot.com ~ "Endorsing products is the American way of expressing individuality." - -Calvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgaPUgACgkQbtAgaoJTgL/kQQCggPuXLrZqT/zmBBALUKUY1/4h P44An2JhhO4GiMgkGP07DULeaV5d5a+u =nH6/ -----END PGP SIGNATURE-----