[bug] Compiler bug or feature?

nicolas cellier ncellier at ifrance.com
Mon May 8 17:57:05 UTC 2006

Le Lundi 08 Mai 2006 19:31, Andreas Raab a écrit :
> 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

I think you forgot super, and maybe thisContext.

Compiler assume they are variables because it searches for variables, and they 
are regularly constructed id made of letters...
Do you mean that true false nil should be detected as literals at Scanner 
level (tokenization) ?

If literals true, false, nil or variables self, super, thisContext should 
always take precedence over arguments and temporaries,
then such arguments would be inaccessible...

IMO, all these tricky constructs would better be forbidden with a hack in the 


More information about the Squeak-dev mailing list