Fun with Symbol
stephane ducasse
stephane.ducasse at free.fr
Wed May 23 09:43:54 UTC 2007
did you try with the new compiler?
On 23 mai 07, at 01:47, nicolas cellier wrote:
> 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
|