From: "Florian Groß" Date: 2004-11-26T10:17:57+09:00 Subject: Re: Fixnum#clone and Float#clone raise different exceptions Yukihiro Matsumoto wrote: > |4.clone -> 4 sounds better to me, but I must be missing something. > > Do you accept the following behavior? > > a = 4 > a.instance_eval{@a=5} > b = a.clone # b = 4 > b.instance_eval{@a=10} > a.instance_eval{@a} # @a = 10 > > Similar thing can happen for a Float and singleton methods. I think this is okay. I think getting an exception when doing obj.clone is a thing that would be against expected behavior more frequently than sharing instance variables on immediate Objects. (Instance variables on those are not used frequently anyway.) I also think that the above change would bring back consistency between obj.clone and Marshal.load(Marshal.dump(obj)). Maybe a note stating that you don't actually get a new object could be attached to the documentation of the clone and dup methods of Fixnum, Symbol, TrueClass, FalseClass and NilClass.