From: "Chr. Rippel" Date: 2001-11-25T06:18:41+09:00 Subject: [ruby-talk:26367] Re: adding instance variables to an existing class. "Hugh Sasse Staff Elec Eng" wrote > How might I add some instance variables to an existing class, such > as String, and have them initialized properly? ..... If you are working in cvs you can do this easily be redefining allocate. Note that String.allocate is not inherited from Object.allocate - i.e. replacing __allocate with super is not a good idea. class String attr_accessor :pos class << self alias __allocate allocate def allocate (res = __allocate).pos = 0 return res end private :__allocate end end /Christoph