Challenge (was: Re: [Squeak 0003836]: nil ~= 1and: [1 isNil] is parsed+compiled without complaint)

Bert Freudenberg bert at impara.de
Thu Jul 13 15:20:06 UTC 2006


Am 13.07.2006 um 16:49 schrieb David Corking:

> On 7/13/06, Bert Freudenberg <bert at impara.de> wrote:
>> >> Heh. My favourite strange expression is this:
>> >>
>> >> # "hi there" :== '_'
>> >>
>> >> 1) Who can guess what the result is WITHOUT trying it?
>> >> 2) Who can explain what's happening?
>> >> 3) Do we need to fix it?
>> >>
>> >
>> > Nothing happens here except 'Nothing more expected'.  What is  
>> supposed
>> > to happen.
>>
>> Make sure what looks like spaces are actually spaces - when
>> copy&pasting code from an email some systems convert a space (32)
>> into a non-breaking space (160) which the parser does not accept as
>> whitespace.
>
> OK.  Now I have pasted it correctly (the underscore in my email
> systems charset magically changed to a left arrow in the Squeak
> workspace.) I changed the space characters by hand.
> Now nothing at all happens.
> What happens on your image?  Which image are you using?

This expression happens to be parsed without errors and answers true  
(use "print it" to see the result). The result is unexpected for me,  
and I guess for everyone except maybe the guy who created that hack  
to allow ':=' to be used for assignment.

As Lukas pointed out the actual culprit is Scanner>>xColon, it's a  
simple fix (^ token := #':=') which doesn't seem to break anything  
immediately and makes this expression answer true:

	#:= == #':='

The original line served only to obscure the actual problem. Which  
isn't really a problem because we write Smalltalk code, not Perl, so  
nobody would ever notice anyway ;-)

- Bert -




More information about the Squeak-dev mailing list