binary selectors ambiguity and space

nicolas cellier ncellier at ifrance.com
Sat May 13 00:10:48 UTC 2006


Sorry cannot find the thread which started this discussion,
but it seems i cannot have some binary selector with minus sign last.

For example, i can compile
    Compiler evaluate: 'nil -+ nil'
Or
    Compiler evaluate: 'nil -/+ nil'

But i cannot compile
    Compiler evaluate: 'nil +- nil'
nor
    Compiler evaluate: 'nil +/- nil'

I understand that eventually some expressions might be ambiguous like
 1+-2 that can be interpreted as (1) + (-2) or (1) +- (2)
But such ambiguity could raise an error or warning,
and in most case, spaces will help disambiguating:
 1+-   2 would be (1) +- (2)
 1+   -2 would be (1) + (-2)

Funny, in current 3.9 spaces are ignored:
i have '1 +-   2' interpreted as (1) + (-2) 

I cannot even write 1 +-+ 2, though no ambiguity lie there...

I guess all this is very squeak specific

Nicolas




More information about the Squeak-dev mailing list