Mildly amusing compiler bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mildly amusing compiler bug

Chris Uppal-3
Hi,

I've just noticed that you can evaluate:

    1 ( 2

to get a walkback, "SmallInteger does not understand #(".

Don't worry, though, you can define the method:

    ( aNumber
        ^ self + aNumber + 23.

and that allows the original expression to evaluate OK.

It works with [ too.

However, there must be a bug in the debugger, because, for some reason, it
won't allow you to implement either method directly ;-)

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Mildly amusing compiler bug

Ian Bartholomew-19
Chris,

> However, there must be a bug in the debugger, because, for some reason, it
> won't allow you to implement either method directly ;-)

You've probably worked it out already but the "Implement It" option is
disabled because Symbol>>isLiteralSymbol: answers false for #'('

More strangeness. Try to implement ....

( anNumber
    ^self + aNumber + 23

in a class. Using "Accept/Reformat" (have you still got that enabled?)
throws an error.  If you just "Accept" it the method compiles without any
obvious error, and works (as in the Debugger).  However, every time you
browse the method in a browser the Transcript reports "Error 32 on line 1
of Object>>( -> 'expecting message pattern'".  Having two different
compilers in Dolphin does make things interesting :-)

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.