From: Christophe Mckeon Date: 2007-12-14T23:24:15+09:00 Subject: Re: Is there any way to redefine the `new' method? another way: module Scheme class Symbol @names = {} def self.new name @names[name.to_sym] ||= super end def initialize name @name = name.to_sym end end end foo1 = Scheme::Symbol.new(:foo) foo2 = Scheme::Symbol.new(:foo) bar1 = Scheme::Symbol.new(:bar) bar2 = Scheme::Symbol.new(:bar) puts ((foo1 == foo2) && (bar1 == bar2) && (bar1 != foo1)) -- Posted via http://www.ruby-forum.com/.