Joel VanderWerf wrote:
> 
> Lyle Johnson wrote:
> > copies. The primary difference is that 'clone' copies an object's *entire*
> > state, including its freeze status and instance variables, whereas 'dup'
> > only copies the basic object contents. 
[...]
> irb(main):005:0> x.dup.instance_eval { @y }
> nil
> irb(main):006:0> x.clone.instance_eval { @y }
> 2

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



-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 5. year  )
( \__\_?|?_/__/ ) _)Industrial economics and technological management(
 \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)