Modules and class... [ a off-topic question ?]
Lex Spoon
lex at cc.gatech.edu
Wed Feb 27 15:10:27 UTC 2002
> > 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.
>
> You've described a constructor, not a class.
Does a constructor include a specific definition of instance variable
layouts, and a specific set of methods?
> > 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.
>
> You've described a namespace, not a module.
A namespace is one of the most important parts of a module. Another
important part is dependency information, which normally wouldn't be
included in an individual class (you could, but it would seem like quite
a burden!). What aspect of modules have I left out, that you consider
important?
Overall, these descriptions seemed pretty obvious to me. If you are
using different terminology, that would probably explain a lot of the
apparent disagreement in the modules discussions here.
-Lex
More information about the Squeak-dev
mailing list
|