[OT] Writing a parser for BASIC in Smalltalk/Squeak ? (<CSOTD> included)

Henrik Gedenryd h.gedenryd at open.ac.uk
Wed Jan 9 19:08:16 UTC 2002


Tim Rowledge wrote:

>> Indeed. I wonder if this behaviour is actually defined somewhere? It's at
>> least counter-intuitive.
> [snips]
>>>> | m n |
>>>> n _ 2.
>>>> m _ 3.
>>>> n _ m + (m _ n)
> That's a very polite way of putting it!
> 
> Looking at the bytecodes of the method clearly show why it happens and
> I think it must count as a pretty nasty bug.

Sorry, I must protest. This is entirely to be expected, as this is
"call-by-value" or whatever is the proper name, as vs. call-by-reference or
some such. A variable holding an integer refers to that integer object,
which is pushed, then another integer object is pushed when that has become
the new value of the variable.

Henrik





More information about the Squeak-dev mailing list