[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01090] Re: Infinite loop

From: Dave Thomas <Dave@...>
Date: 2000-01-11 08:22:14 UTC
List: ruby-talk #1090
Clemens Hintze <c.hintze@gmx.net> writes:



> Perhaps the hash function of that array, could be able to know that
> it is calculating the reference to itself and so does not looping?!?

     a = [1,2,3]
     a[1] = a
     p a
     p a.to_s
     p a.id
     p a.hash
  >>
     [1, [...], 3]
     "11[...]33"
     537681066
     <<infinite loop>>


Exactly - it just seems inconsistent, but as I mentioned originally, I 
don't think it's necessarily a bug ;-)



Regards

Dave

In This Thread