[squeak-dev] Unloading MC definitions from an Environment

Frank Shearar frank.shearar at gmail.com
Sat Dec 21 13:18:33 UTC 2013


At the moment an MCClassDefinition unloads from Smalltalk (via a
hardcoded reference). The obvious adjustment is to make unload like
this:

MCClassDefinition >> unload
    | environment |
    environment := EnvironmentRequest signal ifNil: [Smalltalk].
    environment removeClassNamed: name

However. While this will work when you're always working in the same
environment, what about this craziness?:

| env1 env2 |
env1 := Environment withName: 'env1'.
env2 := Environment withName: 'env2'.

[myMcVersion load] on: EnvironmentRequest do: [:e | e resume: env1].
[myMcVersion unload] on: EnvironmentRequest do: [:e | e resume: env2].

Obviously, myMcVersion's definitions will remain in env1, while the
second line will quietly fail. (Quietly, in the sense that the
Transcript will tell you the removal was ignored.)

Actually, that seems quite fine. I'll carry on rewriting the MC tests
in the meantime, but I'd appreciate your time in thinking about any
possible pitfalls.

frank


More information about the Squeak-dev mailing list