Modules and class... [ a off-topic question ?]

Lex Spoon lex at cc.gatech.edu
Tue Feb 26 20:32:43 UTC 2002


> I think that it is mostly lack of experience in this space that is doing
> the talking here amongst Squeak folks. 


I think my intuitive decomposition of classes and modules may be similar
to others', so let me toss it out.

A class primarily declares a number of instance variables, and holds a
number of methods, and can be instantiated.  It can also define
variables in a local scope, but that's secondary and not even necessary
if we have modules.

A module primarily defines variables in a local scope.  Theoretically,
it could have instance variables, could have methods, and could even
allow instantiation.  These abilities are not only secondary, but might
not be necessary at all.

Looking at this, there isn't much of an intersection in the common uses.
 Why don't we just say that a class *has* a module (to hold class
variables), and leave it at that?


Of course, I haven't implemented a Smalltalk modules system and
developed it over 10 years, so I may be being naive here.  I just worry
about equating ideas just because their implementations share some
features.  Conceptually the two things are different, and thus
implementing them as the same thing is bothersome.  This is the core of
the language, so let's keep it as clean as we can!



-Lex



More information about the Squeak-dev mailing list