From: George Ogata Date: 2004-04-04T07:09:22+09:00 Subject: Re: [newbie] What is the difference between dup and clone ? Alexey Verkhovsky writes: > OK, clone copies frozen state, and dup doesn't (but both copy tainted) - > this much I understand. > > But the Rdoc (quoted fully below) hints at some other distinction, saying: > > "While clone is used to duplicate an object, including its internal > state, dup typically uses the class of the descendent object to create > the new instance." Well, one distinction is that singleton class stuff is `clone'd, but not `dup'ed: o = Object.new class << o def scare puts 'boo!' end end o.clone.scare # ok o.dup.scare # NoMethodError HTH