From: Phillip Gawlowski Date: 2008-05-02T07:51:03+09:00 Subject: Re: Please explain nuances of ||= -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David A. Black wrote: | Hi -- | | It's possible to generalize it; someone in one of the threads wrote a | class that showed the same behavior, but I can't remember the details. | I do wish it were otherwise; it's definitely unexpected, I think. Well, it is unexpected if you forget about the default value for Hash, for example. So, I agree: On first sight it *is* unintuitive. Once you think about, though.. As a tangent: I've just checked my copy of The Ruby Way, and its 'Training your intuition' sub-chapter. This gotcha isn't part of it. :( Maybe it could be added for the next edition (unless Ruby 1.9/2.0 is the reason for the new edition, and the ambiguity/idiosyncrasy is removed in the new version of Ruby by then). - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan Blog: http://justarubyist.blogspot.com ~ "Oops, I always forget the purpose of competition is to divide people into winners and losers." -Hobbes being sarcastic -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgaSVoACgkQbtAgaoJTgL+ExwCgjbqnS7cqvvMHhPy5PRt8DX9Y nOkAoJF5YjaZuXQA71NhvdpEe/9zlFdx =sYWv -----END PGP SIGNATURE-----