From: Vladimir Dozen Date: 2002-03-13T22:27:06+09:00 Subject: key comparision inside Hash ehlo. A few Q's: 1. Where can I get information on Ruby's garbage collector algorithms? Where can I get "internals" info on Ruby in general? 2. How should I change the following code to get my object back from Hash? ===================== class Key include Comparable def initialize(a,b) @a = a @b = b end attr_reader :a, :b def <=> (another) @a <=> another.a || @b <=> another.b end end hsh = Hash.new key1 = Key.new(1,2) key2 = Key.new(1,2) # the keys are considered equal, but... hsh[key1] = "hello" print "Value by separate key:",hsh[key2],"\n" ===================== I always get nil. Being C++ programmer, I expected comparision operator will be used to match the keys inside hash; I was wrong? dozen