binary selectors ambiguity and space

nicolas cellier ncellier at
Sat May 13 17:43:16 UTC 2006

Hi Wolgang

Le Samedi 13 Mai 2006 18:35, Wolfgang Helbig a écrit :
> Hi Nicolas,
> you found out:
> >$- except as first binary character is forbidden in Scanner>>xBinary
> >Thus '1 +- 2' will scan successive tokens (1) (#+) (#-) (2).
> This complies with the syntax diagrams in the Purple Book (this page is
> left blank in my edition of the Blue Book):
> The minus character must not be the second character of a binary selector.
> Why?

The reason is simply because of negative number literal constants like -2,
So as to avoid ambiguity of expressions like x--2.
Dan said space should not be significant...
In fact, if you look Squeak literal arrays, or VW implementation, you can see 
that in fact it is: #(1-2) and #(1-  2)

> What's so bad about a binary selector like #/- or #\- ? (These 
> selectors would mean Integer division rounded towards minus infinity, as
> opposed to the accepted binary selectors #/+ and #\+, which is, suprise,
> Integer division rounded towards plus infinity.)
> Greetings,
> Wolfgang
> --
> Weniger, aber besser.

I agree, if we remove the limitation (simple) and disambiguate with a 
precedence rule as i proposed (minus sign immediately preceding a digit will 
always form a negated number literal), then we can have plenty of others 
selectors, like <-  +/-  etc... i do not know for what purpose yet but sure 
some will find.
Of course, we deviate from the blue bible, but from Alejandro point of view, 
this is just normal evolution of a living system...
What nobody knows yet is if the Darwinian selection will select this change as 
a viable one.


More information about the Squeak-dev mailing list