[ENH] hook method for removeFromSystem:

Stephane Ducasse ducasse at iam.unibe.ch
Tue Nov 27 10:51:46 UTC 2001


This changeset (two methods) introduces a hook method when removing a class
from the system. The hook method is called lastActionBeforeRemoveFromSystem.
The point of introducing it is that without it developer of classes which
needs to performed some actions before been removed from the system have to
specialize removeFromSystem: on their class and not forget to call the
overriden method using a super removeFromSystem:. This hook frees the
developer from this responsibility and makes then the system safer. We will
need that when unloading classes or modules.

lastActionBeforeRemoveFromSystem
    "This hook lets a class performs a last action before being removed from
the system
    whitout letting the responsibility to the developer to invoke super
removeFromSystem:
    which is the case when we specialize directly removeFromSystem:
sd-15Nov01"
    
    "Do nothing"! !

!Class methodsFor: 'initialize-release' stamp: 'SD 11/15/2001 22:19'!
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! !

-------------- next part --------------
'From Squeak3.2alpha of 3 November 2001 [latest update: #4461] on 16 November 2001 at 9:06:51 pm'!"Change Set:		HookForRemoveFromSystemDate:			16 November 2001Author:			sd <Stephane DucasseVersion 1.0 - 16 Nov 2001Prerequisites: noneThis changeset (two methods) introduces a hook method when removing a class from the system. The hook method is called lastActionBeforeRemoveFromSystem. The point of introducing it is that without it developer of classes which needs to performed some actions like unregistration have to specialize removeFromSystem: on their class and not forget to called the overriden method using a super removeFromSystem:. This hook frees the developer from this responsibility and makes then the system safer. We will need that when unloading classes or modules."!!Class methodsFor: 'initialize-release' stamp: 'SD 11/15/2001 22:18'!lastActionBeforeRemoveFromSystem	"This hook lets a class performs a last action before being removed from the system	whitout letting the responsibility to 
the developer to invoke super removeFromSystem:	which is the case when we specialize directly removeFromSystem: sd-15Nov01"		"Do nothing"! !!Class methodsFor: 'initialize-release' stamp: 'SD 11/15/2001 22:19'!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! !



More information about the Squeak-dev mailing list