Steps to Modularity - Nested Global Variables
Marcel Weiher
marcel at system.de
Tue Mar 16 09:00:58 UTC 1999
> 1. Establish Package.Name as an alternate form of global reference.
Sounds pretty neat. As a matter of fact, why not make 'dot'
notation generally acceptable for retrieving values from (nested)
dictionaries and plain objects (via accessors)? The Package.Name
would then be just a special case of that mechanism.
> 2. Packages are represented in memory as instances of
SystemDictionary.
> In our example there would be a global in Smalltalk named
Thinglab.
> In ThingLab there would be an entry named Line.
> Methods with a reference named Line would bind to the
ThingLab Line
> if compiled inside of ThingLab -- ie if their class is
> in the ThingLab package, otherwise to the global one.
What I would *really* like is for the lookup to be dynamic and
overridable, so that a 'sub-package' can override the references to
globals of its 'super-package', both the internal ones referring to
'globals' provided by the package itself and ones 'imported' from
outside.
Allowing overrides like that should help with the problems you get
with making versions of sets of cooperating classes.
> 3. I don't know if we should support arbitrarily long dotted
references.
> What do you think?
Do it.
> 4. There needs to be a corresponding extension to the
SystemOrganization,
> and to the System Browsers.
> Have you thought about this?
> This is what makes me hesitate about arbitrarily deep nesting.
Do it later?
> 6. I believe this project will be facilitated by adding a pointer
from a
> class to its package dictionary. Believe it or not, this was part
of the
> intention back in ST-76. It was called the "system" pointer, but
it got
> dropped in ST-80 because it hadn't been used yet.
Yes, I agree a back-pointer is just what is needed, although I would
like the package to be more than just a dictionary. Another pointer
I would like to see is for the messager, this could be either in the
package or the class itself. With this back-pointer, it should be
possible to create shared packages that are read-only and integrated
into the system using only the smallest of hooks.
Marcel
More information about the Squeak-dev
mailing list
|