[bug] Compiler bug or feature?

Andreas Raab andreas.raab at gmx.de
Mon May 8 17:31:30 UTC 2006


Wolfgang Helbig wrote:
> All of them print:
> 
> test:  Name is already defined ->self
> 	^self
> 	
> when you type the above code in the system browser and try to save it.

Yes, but if you execute, say:

   Object compile: 'testSelf: self'
   Object compile: 'testNil: nil'
   Object compile: 'testTrue: true'
   Object compile: 'testFalse: false'

It compiles just nicely. So the bug seems to be the treatments of 
nil,true,false,self as variable nodes instead of literal constants. 
Variable nodes may be silently shadowed in some circumstances, literal 
constants cannot, e.g.,

   Object compile: 'test123: 123'
   Object compile: 'testString: ''string'''
   Object compile: 'testSymbol: #symbol'

all correctly fail.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list