From: Lyle Johnson Date: 2002-08-07T22:43:49+09:00 Subject: Re: Dup and Clone Kent Dahl wrote: > The freeze big I kinda understand, the instance variables, however, I > guess is a bug of some sort: > > $ cat dup.rb > x = "foo" > x.instance_eval { @y = 2 } > puts "x.dup.y = " , > x.dup.instance_eval { @y } #=> 2 > puts "x.clone.y = " , > x.clone.instance_eval { @y } #=> 2 > > > $ ruby -v dup.rb ; /usr/local/bin/ruby -v dup.rb > ruby 1.6.6 (2001-12-26) [i586-linux-gnu] > dup.rb:7: warning: instance variable @y not initialized > x.dup.y = > nil > x.clone.y = > 2 > ruby 1.7.2 (2002-07-13) [i686-linux] > x.dup.y = > 2 > x.clone.y = > 2 Hmmm... I see the same changed in behavior here when going from Ruby 1.6.7 to Ruby 1.7.2. And I don't see it mentioned in the doc/NEWS so I wonder if this was an intentional change?