binary selectors ambiguity and space

nicolas cellier ncellier at ifrance.com
Sun May 14 08:22:27 UTC 2006


Le Dimanche 14 Mai 2006 07:58, Wolfgang Helbig a écrit :
> >One way would be to force user to introduce these separators, as proposed
> > by Wolfgang, but i dislike it because user could not write anymore x-1.
>
> This is not what I intended. The notation as proposed by me requires a
> separator only when needed to resolve ambiguities. The separator separates 
> a binary selector from an adjacent "special_character". The separator could
> be a space. But also any other character that must not occur in a binary
> selector. Like a letter or a digit, or, to be more explicit, any character
> that is not a "special character". Just like a nonalphanumeric character is
> required to seperate adjacent identifiers. With binary selectors, a space
> is required only when the binary selector consists of one character
>   AND
>  the next character would be a "special character"
>
> 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".
>
> Greetings
> Wolfgang
>
> --
> Weniger, aber besser.

Sorry, my interpretation was too radical.

I think your proposition is cleaner than mine, because x+-y will be 
interpreted the same way as x+-2, but it does introduce a potential 
compatibility problem, not with +-, my example was badly chosen, but maybe 
with x*-2 or x/-2...

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.

Nicolas




More information about the Squeak-dev mailing list