[squeak-dev] Unreferenced instance variables

Casey Ransberger casey.obrien.r at gmail.com
Tue Dec 14 20:32:00 UTC 2010


+1, I've had this same issue with "unsent" messages getting sent with #perform:orSendTo: et al. Metaprogramming (well, I suppose it's really just late binding) makes it hard to know for certain what's used and what isn't; it's worth searching sources for the string just to be sure. 

I've become awfully interested in analyzing dependencies in ST for this very reason. It's hard/fun:)

On Dec 14, 2010, at 11:28 AM, Chris Muller <asqueaker at gmail.com> wrote:

> 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