Tim vs. Accessors

John M McIntosh johnmci at smalltalkconsulting.com
Sun Oct 7 17:31:12 UTC 2007


On Oct 7, 2007, at 2:43 AM, Ralph Johnson wrote:


> This is especially true if your variables have typical names like
> "name" or "contents" or "children".


Which reminds me if you use a local variable called 'name' in a class  
method say for example.


	name := 'safljalas'

name is *really* an instance variable on Class, as the point when you  
save the method I think there should be some warning about using  
class side instance variables found in the class hierarchy because  
this innocent mistake now has trashed your image.

This confuses the class/metaclass logic, later when I select my class  
Foo it shows as


Object subclass: 'safljalas'
	instanceVariableNames: ''
	classVariableNames: 'Instances'
	poolDictionaries: ''
	category: 'nil'


Browsing all usages of the class Foo then results in a walkback.

SystemDictionary(Object)>>error:
SystemDictionary(Dictionary)>>errorKeyNotFound
[] in SystemDictionary(Dictionary)>>associationAt: {[self  
errorKeyNotFound]}
SystemDictionary(Dictionary)>>associationAt:ifAbsent:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SystemDictionary(Dictionary)>>associationAt:
safljalas class(Behavior)>>allCallsOn
SystemNavigation>>browseAllCallsOnClass:

Also if you select 'Foo' and ask to browse the class it does bring up  
a browser but can't find the Foo class.

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list