This came up on the ruby lang forum.

This seems like a 1.9 bug. Is it?


---------- Forwarded message ----------
From: Aldric Giacomoni <aldric / trevoke.net>
Date: Wed, Aug 26, 2009 at 11:00 AM
Subject: ||=3D with 1.8 and 1.9 ?
To: ruby-talk ML <ruby-talk / ruby-lang.org>


A friend of mine on Twitter recently posted this tidbit of code:

class OrOrEquals
=A0def test
=A0 =A0@test
=A0end

=A0def test=3D(test)
=A0 =A0@test =3D test
=A0 =A0'not test'
=A0end
end

p (OrOrEquals.new.test =3D 'test')
# ruby 1.8 returns 'test'
# ruby 1.9 returns 'test'

p (OrOrEquals.new.test ||=3D 'test')
# ruby 1.8 returns 'test'
# ruby 1.9 returns 'not test'

It works as indicated. Is this -normal- behavior ?
--



--=20
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale