At 23:51 08/07/21, Urabe Shyouhei wrote:

>FYI, expression "true" refers to the same object on multiple invocations:
>
>irb(main):001:0> a = true
>=> true
>irb(main):002:0> a.instance_variable_set "@foo", ["bar", "baz"]
>=> ["bar", "baz"]
>irb(main):003:0> b = true
>=> true
>irb(main):004:0> b.instance_variable_get "@foo"
>=> ["bar", "baz"]
>irb(main):005:0> 

Is this an actual example shunk down, or is it just made up to
show a point? If it's the later (as I suspect), then yes, objects
such as nil and true and false are to a large extent real objects,
and so can have instance variables and so on.

But what we need to show that letting dup return self for true and
friends is a bad idea is not just that they refer to the same object,
but that this fact, combined with the usual use of these objects
(not some bordercase example) creates real problems.

We have already seen three or four people tell us that they
redefine dup or create another (safer, according to Jim) method.
We have heard from several people that extending the definition of
dup wouldn't lead to problems as far as they knew.

We haven't had anybody claim, or show us, that or how extending
dup semantics would actually cause a problem in real use.

Regards,   Martin.



#-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-#  http://www.sw.it.aoyama.ac.jp       mailto:duerst / it.aoyama.ac.jp