smalltalkdolphin-smalltalk

How to perform a specific action when a class is removed from system in Dolphin


I'd like to perform a specific action just before/after a class is removed from system (from SystemDictionary) - like unregistering the class from a certain list/dictionary of well known classes.

In Visualworks and Squeak/Pharo, I just have to define the message #obsolete at class side.

obsolete
    self unregisterSomething.
    ^super obsolete

Is there an equivalent in Dolphin Smalltalk?


Solution

  • You have to check the method #uninitializeBeforeRemove.

    If your class is BankAccount then you have to implement:

    BankAccount class>>uninitializeBeforeRemove
    

    (implement it in the class side).

    Read the comments at Class>>uninitializeBeforeRemove