Dan Sugalski <[EMAIL PROTECTED]> writes: > At 11:13 AM +0100 12/14/04, Leopold Toetsch wrote: >>Dan Sugalski <[EMAIL PROTECTED]> wrote: >> >>> subclass - To create a subclass of a class object >> >>Is existing and used. > > Right. I was listing the things we need in the protocol. Some of them > we've got, some we don't, and some of the stuff we have we probably > need to toss out or redo. > >> > add_parent - To add a parent to the class this is invoked on >>> become_parent - Called on the class passed as a parameter to >>> add_parent >> >>What is the latter used for? > > To give the newly added parent class a chance to do some setup in the > child class, if there's a need for it. There probably won't be in > most cases, but when mixing in classes of different families I think > we're going to need this.
The chap who's writing Ruby on Rails, a very capable framework reckons that some of these 'meta' method calls that Ruby has in abundance have really made his life a lot easier; they're not the sort of things you need to use very often, but they're fabulously useful when you do.