[squeak-dev] Environment changes in the Inbox

Jakob Reschke jakob.reschke at student.hpi.de
Wed Mar 22 15:36:43 UTC 2017

2017-03-22 16:03 GMT+01:00 H. Hirzel <hannes.hirzel at gmail.com>:
> And what is the proper way of 'unregistering' an environment?

Probably Environment>>destroy should also wipe the instance from
Instances. Nicolas is right that there currently is no way to
unregister an environment. There is not even a method to list the
registered ones.

> Environment >>
> destroy
>         self allClasses do: [:ea | ea removeFromSystem].
>         declarations keys do: [:ea | self unbind: ea].
>         policies do: [:ea | ea removeObserver: self].
>         observers do: [:ea | ea stopObserving: self].
> Is this all I have to do or do I need to do something more to
> unregister an environment?
> --Hannes

Currently, you would have to kick an environment out of Instances
manually via inspectors or the like. After #destroy only, it is empty
and disconnected from other environments, but it will not be garbage

So we could either make Instances weak-valued, or unregister on
destroy. Or both... Note that an emptied and disconnected environment
without behaviors (= currently useless?) will be garbage collected in
the weak-Instances solution.

More information about the Squeak-dev mailing list