From: Jean-Hugues ROBERT Date: 2004-04-08T14:00:26+09:00 Subject: Re: IdentityHash, like Hash but with keys using equals? vs eql? At 07:44 08/04/2004 +0900, you wrote: >Jean-Hugues ROBERT writes: > > > BTW: I need that to detect "true" circular paths when walking a tree/graph. > > Rigth now I detect false circulars when nodes' values compare equal > > where in fact it is two different node objects (with the same "value"). > >Can you just hash the ids? > >hash[obj.id] = blah Yes ! So: an IdentityHash in ruby is just a Hash, but with obj.object_id() in it vs the obj itself. Makes a lot of sense. Thanks George ! Jean-Hugues PS: As one said, in Computer Science everything is solvable by adding one indirection level. ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17