[squeak-dev] Unreferenced instance variables

Chris Muller asqueaker at gmail.com
Tue Dec 14 19:28:36 UTC 2010


An inst-var could, theoretically be used but still appear unreferenced
if access to it was only via instVarNamed: and instVarNamed:put:.
Doubtful, but to be extra safe, we might want to check String literals
equal to the inst-var name as part of the research of removing an
instVar...

On Mon, Dec 13, 2010 at 3:21 PM, Bernhard Pieber <bernhard at pieber.com> wrote:
> Dear Squeakers,
>
> I just found out that we have quite a few unreferenced instance variables. I found 139 classes in a current trunk image. I used the following script:
>
> | unreferencedInstVars |
> unreferencedInstVars := Dictionary new.
> SystemNavigation default allBehaviorsDo: [:each |
>        | instVars |
>        (instVars := each unreferencedInstanceVariables) notEmpty
>                ifTrue: [unreferencedInstVars at: each put: instVars]].
> unreferencedInstVars
>
> Could all of these be removed? Or are there reasons why some of those inst vars must not be deleted?
>
> Curiously,
> Bernhard
>



More information about the Squeak-dev mailing list