On 27.05.2009 22:08, Oliver Saunders wrote: > For those interested to know what I was doing I was trying to implement > a layer for prototype-based OO in Ruby. Didn't really work though. Please correct me if I am wrong, but you seem to mean http://en.wikipedia.org/wiki/Prototype-based_programming Would this approximate what you're after? prototype = Object.new class <<prototype def foo printf "%p %p\n", self, self.class end end o1 = prototype.clone o2 = prototype.clone o1.foo o2.foo > As > far as I know (and please correct me if I'm wrong) Ruby doesn't allow > you to call a method redefining the meaning of self for the purpose of > the call (e.g. apply() in JS) and without this feature you can't really > implement this layer in any useful way. #instance_eval does exactly that: it temporarily sets self to point to a particular instance. But it seems apply() in JS world is used to do something else http://www.devguru.com/Technologies/ecmascript/quickref/apply.html Basically you would need it to call "super class" methods. A few solutions come to mind. For construction you can do def base o = Object.new class <<o def base_meth end end o end def derived o = base # alt: prototype.clone class <<o def derived_meth end end o end If your search the archives I am pretty sure you'll find something about prototype based OO in Ruby. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/