binary selectors ambiguity and space

Wolfgang Helbig helbig at Lehre.BA-Stuttgart.DE
Mon May 15 05:41:58 UTC 2006

Hi Nicolas,

we were discussing:

>> So "x+-3" would be parsed as "x" "+-" "3". And only if you want it to be
>> parsed as "x" "+" "-3", you need to hit the large key to write "x+ -3".

>In such case, i have a natural tendancy to favour compatibility solution, but 
>maybe we should prefer the clean solution to be selected, with some tools to 
>help making the transition.
>It is simple to detect the case in Scanner>>xBinary and have an Exception 
>raised in that case. The exception defaultAction would be to proceed simply. 
>But this Exception can also be caught and pop up a warning. I will try today 
>to parse a 3.9 image, a kind of statistical test just to check if this 
>ambiguity is hypothetic or is really hurting squeakers.

The  Scanner>>xBinary method should not at all accept expressions like "x+-3". 
Instead it should kindly ask the programmer to resolve the ambiguity by 
inserting white space. Without taking a default action. Expressions are 
ambiguous, if a minus character can be parsed both as the second character of a 
binary selector and as the first character of a number literal.

If the folks start grumbling at this pedantry tell them Monk was here :-)

Weniger, aber besser.

More information about the Squeak-dev mailing list