Unloading MC definitions from an Environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unloading MC definitions from an Environment

Frank Shearar-3
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

Reply | Threaded
Open this post in threaded view
|

Re: Unloading MC definitions from an Environment

Colin Putney-3



On Sat, Dec 21, 2013 at 8:18 AM, Frank Shearar <[hidden email]> wrote:

| 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.

Yeah, sounds right to me too.