> ----------- > > We need private methods for objects. > > ----------- just a comment on how this is done for ruby: <code>
#initially objects are created with a given class #say aFoo is an instance of class Foo aFoo = Foo.new #then we can add methods to aFoo def aFoo.bar() puts 'invoked bar' end #this actually created an anonymous class (called a singleton #class in ruby speak) which derives from Foo and was set as aFoo's #actual class. #the exact same thing could have been done more explicitly by doing this class <<aFoo #creates (or retrieve) the singleton class for a Foo and open its def def bar() puts 'invoked bar' end end </code> what all this means is that having objects method only requires to be able to change an object class at runtime and at that only to change it to a subclass of its original class. Benoit