Fun with Symbol

nicolas cellier ncellier at ifrance.com
Tue May 22 23:47:56 UTC 2007


Hello list,

Today's quizz: guess the results of these evaluations and how it prints

Easy to begin with:
	Compiler evaluate: '#++'.
Yes Scanner class>>#isLiteralSymbol: not really consistent with what the 
parser is ready to understand. It even has some unreachable code in it.

Now what if:
	Compiler evaluate: '##'.
Enjoy the variations, not all correct:
	Compiler evaluate: '#'.
	Compiler evaluate: '# "please" # "print" # "me"'.
	Compiler evaluate: '##()'.
	Compiler evaluate: '##)'.
	Compiler evaluate: '##('.
	Compiler evaluate: '##(##)'.
Never heard about explicit number literal?
	Compiler evaluate: '#1'.
Maybe the negative ones would work?
	Compiler evaluate: '#-1'.
So try and explain this one:
	Compiler evaluate: '#--1'.

Hmm, better correcting the parser than trying to write its EBNF rules!

Nicolas




More information about the Squeak-dev mailing list