From: Paul Brannan Date: 2002-09-10T22:43:01+09:00 Subject: Re: ruby-dev summary 18111-18212 On Tue, Sep 10, 2002 at 09:17:39AM +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: ruby-dev summary 18111-18212" > on 02/09/09, Paul Brannan writes: > > |Someone on irc pointed out that there is an Object#become in CVS now. > |When I look at the source, though, it doesn't look like it does anything > |except raise an exception if obj is frozen or if obj and orig are not > |the same type. Then it returns the original object. > > Because "become" is a method to copy internal state that Ruby > interpreter does not know, the default "become" does nothing but > freeze check. Interesting. Is this what "become" does in Smalltalk? Also, in Ruby 1.6 I might write: class Foo def clone puts "clone!" return Foo.new end end f = Foo.new p f.dup I'm implementing only "clone" because dup in 1.6 is implemented in terms of clone. So the output I get from 1.6 is: clone! # but Ruby 1.7 gives me: # if I want to implement dup/clone for an object in an extension, what is the correct way to do this so that it will work with both 1.6 and 1.7? Paul