[BUG] ??? Assignment without variable declaration

chenais patrick.chenais at id.unibe.ch
Thu Jun 10 13:44:39 UTC 2004


Hello!
The class variables are kept (declared), even if explicitly removed. 
It is ok? (i.e. the messages are not recompiled.)
I had expected either a forced recompilation of the class messages (while
removing the class variable), or a run time error.

Patrick Chénais



Procedure:
.....................................................
1. Create a new Class ->

Object subclass: #MyFirstClass
	instanceVariableNames: 'alpha'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Patrick-Nodes'

.....................................................
2. Create new messages in category accessing -> 

alpha: aNumber
	alpha := aNumber

alpha
	^ alpha

.....................................................
3. Try it ->

x := MyFirstClass new alpha: 12.
x alpha 12 (Print)
x beta (Print) MessageNotUnderstood: MyFirstClass>>beta

UNTIL NOW, ALL WORK VERY FINE... :))

.....................................................
But
.....................................................

4. Now remove Variable alpha

Object subclass: #MyFirstClass
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Patrick-Nodes'

.....................................................
4. Try it  ->

x := MyFirstClass new alpha: 24.
x alpha 24 (Print)

Works also fine, but wrong :( because variable alpha does not exist anymore.
It should provoke a run time error, isn't it?






More information about the Squeak-dev mailing list