[Q] Modules- just classes or more?

Henrik Gedenryd h.gedenryd at open.ac.uk
Mon Feb 25 09:02:26 UTC 2002


goran.hultgren at bluefish.se wrote:

>> Repository>>contentsOn: is used for writing the content of a module. It is
>> simply a 'fileOut'
> 
> If you take a closer look the first part is for writing the contents of
> defined names that are not Behaviors nor Modules. It calls
> variableDefinitionFor: to produce the representation that can recreate
> the defined name when loading back in.

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.

So right now you use initialization methods to assignvalues to variables.

But I left the hook there so that one could do something with it anyway if
one would want to.

Henrik




More information about the Squeak-dev mailing list