Jim Weirich wrote:
> 
> On Jul 21, 2008, at 11:03 AM, Jim Weirich wrote:
> 
>> (I would also not oppose a change that "extends" the definition of dup 
>> to include returning self for immutable objects.
> 
> Heh, this thought just came to me.  We can explain :dup on nil (and 
> other immutables) as implementing a copy on write strategy to 
> duplication.  And since these objects are immutable, we have optimized 
> away all the overhead of actually tracking "copy on write"

But even with copy on write, object_id differs (if I am reading this right):

irb(main):001:0> s = "foo"
=> "foo"
irb(main):002:0> t = s.dup
=> "foo"
irb(main):003:0> s.object_id
=> -605475328
irb(main):004:0> t.object_id
=> -605479228

I'm not really disagreeing with you. It's not clear that "the object_id 
changes" should be part of the "contract" of a dup operation.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407