[Q] Modules- just classes or more?

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


> I wasn't sure about this for a while, but now I am of the opinion that
> modules should only define the variables, and not their contents.
> 
> Firstly, producing a Smalltalk expression to recreate the contents of a
> variable (i.e. recreate in principle any possible object) is not a
> well-defined and easily solvable problem.
> 
> Secondly, modules define programs, i.e. in this case, define variables, but
> not their contents. Compare to how in other languages you declare variables
> in a declarations section, but initialize the contents inside the running
> program. When languages allow you to declare and initialize a variable at
> the same time, this is done within the running program. And modules just
> define "dead" code, not running programs.
> 

Programs aren't just code.  Putting data in modules has some problems,
but then so does putting ideas into code to begin with.  :)  I'm only
curious why you only mention using *expressions* to initialize variables
-- why not serialize the object?  :)

Really, the only problem seems to be what happens when a class in a
different module changes its layout, and thus invalidates the stored
object in your module file.  Okay, it's a big problem, but, putting the
values of the variables in there is also a very nice benefit.... 
Languages that don't have this built in, seem to end up with ways to
serialize data in more ad hoc ways.

-Lex



More information about the Squeak-dev mailing list