Musings about modularity and programming in the large
Andreas Raab
andreas.raab at gmx.de
Thu Jan 24 18:31:55 UTC 2008
itsme213 wrote:
> "Ignacio Vivona" <altobarba at gmail.com> wrote in message
> news:7d92ea5d0801240640x1766cf19md17c3e5d58b5c208 at mail.gmail.com...
>> why is not having metaclasses a nice feature?
>
> It is about metaclasses not being "special" or hidden or singletons, but
> being just as user-accessible, definable, instantiable, and extensible as
> any other object (and class). It is a much simpler meta-structure than
> Smalltalk-80.
>
> e.g. See
> http://www.iam.unibe.ch/~ducasse/Web/ArchivedLectures/p156-cointe.pdf.
I'll have to admit I never liked this model too much. One of the killer
features of the Smalltalk-80 model is that it allows you to add features
to the meta class easily (by just clicking on the meta-tab in the
browser) be that class instance variables, instances creation, utility,
example, or test methods. That is something that although I'm in favour
of simplicity I wouldn't want to live without and if you look at usage
patterns, like:
n := c := 0.
Smalltalk allClassesDo:[:cls|
n := n + 1.
cls selectors isEmpty ifFalse:[c := c + 1].
].
c asFloat / n asFloat.
you will find that 90+ per cent of the classes in a random image
actually make use of their private meta class. But once you agree that
these are desirable features, there is only so many ways in which you
can do them.
I think the main question here is: How often do people extend their
meta-classes by a few simple utility methods vs. how often do they do
more elaborate changes that can't be represented well in the ST-80
Metaclass hierarchy? Given the data points it appears to me that Dan et
al. got it just about exactly right.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|