Musings about modularity and programming in the large
itsme213 at hotmail.com
Fri Jan 25 14:48:25 UTC 2008
"Igor Stasenko" <siguctua at gmail.com> wrote in message
>> Would something like that be relevant to not breaking the inheritance of
>> metaclass hierarchy?
> I heard about this a while ago. IIRC perl having per-object behavior
> But this can be easily made , when object model is prototype based
> And in ST we having a class-based model.
> Btw, can you show us a 'killer' use case of such language feature,
> which shows great benefit comparing to class-based model? I'm very
> intrigued. :)
Ruby is a class-based, not a prototype-based language. It allows per-object
customization by silently inserting a per-object class only where needed,
but does not go the next step with the required "self" magic of a
prototype-based language. Smalltalk can do this easily (perhaps not as
conveniently as Ruby) e.g. Avi has a package on SqueakSource called
Prototype, I think.
More importantly, I was not pushing prototype-based languages at all. I was
simply asking if the Ruby way of inserting an anonymous class could be used
safely at the meta-level:
- Every class C is an instance of its own class CC, which is Class by
- Every "class-side" customization of C (class inst-vars, class methods,
etc.) will either
- customize the explicit CC (named, shareable, etc.) meta-class, or
- insert an anonymous subclass of CC, and then customize that
If something like this worked, it could retain most of the convenience of
the simple instance/class browser tabs for many users, and still allow
full-blown meta-class manipulation where needed.
More information about the Squeak-dev