Unloading a class from the image

ducasse ducasse at iam.unibe.ch
Sat Nov 10 20:47:10 UTC 2001


Thanks for that. Indeed the changeSet is a nice way to spy actions.
Roel my colleague made in VW a tool that is dependent (dependencies) from
the ChangeSet and then knows everything you made.

I was looking at removeFromSystem methods. It works well, one problem I saw
is that I would like to avoid to let a class programmer to invoke via super
removeFromSystem:, so I think that introducing a hook method into
removeFromSystem: would be nice. This way we would just have to specify what
should be done and let the template plays its role


Instead of 

MyClass class>>removeFromSystem: xxx

    mystuff
    super removeFromSystem: xxx
    
I would like to have

Class>>removeFromSystem: logged
    "Forget the receiver from the Smalltalk global dictionary. Any existing
    instances will refer to an obsolete version of the receiver."

    self lastActionBeforeRemoveFromSystem.
    self superclass ifNotNil:[
        "If we have no superclass there's nothing to be remembered"
        self superclass addObsoleteSubclass: self].
    self environment removeClassFromSystem: self logged: logged.
    self obsolete


Class>> lastActionBeforeRemoveFromSystem
    "Hook method that is invoked before a class is removed from the system.
    Per default does nothing"
    

MyClass class>>lastActionBeforeRemoveFromSystem

    mystuff. 



Any thoughts? May be the hook should be protected in an unwind like block
Do you think that I should submit it as an enhancement?


Stef





More information about the Squeak-dev mailing list