binary selectors ambiguity and space
Dan Ingalls
Dan at SqueakLand.org
Sat May 13 00:36:31 UTC 2006
Well, the *idea* was that you should not need spaces, and St-76, borrowing from APL, had a different character for the semantically different high-minus sign for negative literals, so this was not a problem. High-minus bit the dust with the ascii changes of St80 thus necessitating a space before negative literals that follow binary messages.
>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)
Agreed.
>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...
Agreed.
>I guess all this is very squeak specific
I don't know, but it ought to be fixed.
- Dan
More information about the Squeak-dev
mailing list
|