Hi -- On Mon, 21 Jul 2008, Robert Dober wrote: > On Mon, Jul 21, 2008 at 8:21 AM, Urabe Shyouhei <shyouhei / ruby-lang.org> wrote: >> +1 to David. A convenient way to do Marshal idiom should be a new >> method rather than an extension to existing dup semantics. >> > I strongly disagree with this, it looks like an ugly workaround to me. > Either dup shall not exist for any immutable class, this is the status > quo, I believe. > Or it should be returning self for immutable objects. This does not > seem dangerous to me as the values > are immutable anyway. As such I feel #dup! much misleading. It's a question of the accuracy of the method name. If dup doesn't actually mean "duplicate this object", then it's a bad name for the method. The idea of dup! is that the ! would mean you've decided you want the not-quite-literal behavior. I'm not really pushing for it to exist but it's definitely not a workaround; it's just a suggestion for a way to protect the semantics of dup while still allowing for a way to avoid these TypeErrors with objects that can't duplicate themselves. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails July 21-24 Edison, NJ * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!