Hi all,
this tiny goodie removes all entries without references from Undeclared. Maybe this should be called after every file in.
Michael
'From Squeak2.8alpha of 19 January 2000 [latest update: #2052] on 5 May 2000 at 1:27:13 pm'!
!Utilities class methodsFor: 'miscellaneous' stamp: 'mir 5/5/2000 13:26'! cleanupUndeclared | toBeRemoved refs | "Utilities cleanupUndeclared"
toBeRemoved _ Set new. Undeclared associationsDo: [:assoc | refs _ Smalltalk allCallsOn: assoc. refs isEmpty ifTrue: [toBeRemoved add: assoc key]]. toBeRemoved do: [:each | Undeclared removeKey: each]! !
Michael Rueger wrote:
Hi all,
this tiny goodie removes all entries without references from Undeclared. Maybe this should be called after every file in.
Michael
You might want to check on how the references are computed- another thing of interest is to check whether methods are referencing variables which are not only not in Smalltalk, but are not in Undeclared- thus, a compiled method has a binding for a variable ( an association in Squeak ) but that particular association is not in Smalltalk or any of the other pools ( those for class variables, or in shared pools, of which Smalltalk and Undeclared are well known shared pools ).
Or, to put it another way, rather than have just a tool to "clean up" Undeclared, have a tool that assures the consistency of the variables bound within the image.
A more involved solution would take a while to describe, but involves having code-altering entities keep track of what they are doing so that they can retract interests in particular variables when they leave. It is then up to the "image" to decide when a variable would be dropped from some shared pool.
- les
Michael,
how's your ENH different to "Smalltalk cleanOutUndeclared" ? It looks very similar.
bye -- Stefan Matthias Aust // ...come on, kiss the frog!
Stefan Matthias Aust wrote:
how's your ENH different to "Smalltalk cleanOutUndeclared" ? It looks very similar.
It's less complete ;-)
I got misled by the fact that there was no menu entry for this function.
And it again proves the point that it is so easy to implement things like this in Smalltalk that it's often easier to "just do it" than to find an existing function. Call it the unixification of smalltalk ;-)
Michael
squeak-dev@lists.squeakfoundation.org