Tom Willis wrote:
...
> class PointID
>   attr_reader :x,:y
> 
>   def initialize(x,y)
>     @x = x
>     @y = y
>     @x.freeze
>     @y.freeze
> 
>   end
> 
>   def hash
>     return [@x.object_id,@y.object_id].to_s
>   end
> 
>   def ==(other)
>     return hash == other.hash
>   end 
> 
>   def to_s
>     return hash()
>   end
> 
> end

One approach to this problem that saves some typing (but isn't terribly
efficient because it generates garbage arrays):

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/1555