From: Michael Neumann Date: 2004-05-01T23:18:17+09:00 Subject: Don't understand hashing... Hi, Don't know why this happens: class Lazy self.methods.reject{|m| m =~ /^__(.*)__$/}.each {|m| eval "def #{m}(*args, &block) __getobj__.send(:'#{m}', *args, &block) end" } def initialize(&block) @block = block end def __getobj__ if @block @value = @block.call(*@args) @block = nil end return @value end def method_missing(id, *args, &block) __getobj__.send(id, *args, &block) end def hash __getobj__.hash end end id1 = Lazy.new {:Id} id2 = :Id p id1.hash == id2.hash # => true h1 = {} h2 = {} h1[id1] = "id1" h2[id2] = "id2" p h1[id2] # => nil (expect: "id1") p h2[id1] # => "id2" I would have expected "id1" for h1[id2]. Can someone enlighten me? Thanks. Michael