Re: Negative float consts

From: Pierre Weis (
Date: Tue Jan 14 1997 - 20:59:17 MET

From: Pierre Weis <>
Message-Id: <>
Subject: Re: Negative float consts
In-Reply-To: <> from Christian Boos at "Jan 14, 97 05:19:19 pm"
To: (Christian Boos)
Date: Tue, 14 Jan 1997 20:59:17 +0100 (MET)


> I recently found the syntax of negative float consts to be annoying.
> You have to write things like this:
> two_float_func 1.0 (-. 1.0)

You could also use
         two_float_func 1.0 (-1.0)

> IMO, it is more pleasant to write instead:
> two_float_func 1.0 -1.0
> so I tried the following change in the lexer:
> ... and everything worked well ! I think this could be an improvement in
> the readability of numerical programs.

We abandoned this idea, since users seem to like operations without
spaces, writing


and conversely


If we had adopted negative lexems then we have a discrepancy, since
x+1 would have been an addition, while x-1 would have been an
application (interpreted as x(-1)).

In my mind, the advantages of negative lexems overcome the need of
sparse extra spaces (that we already have to add anyway, for instance
in x:=!x+1 (written x:= !x+1, to avoid the interpretation of :=! as a
single operator)). But some users argue that minimum spacing is a
well-established mathematical tradition, so that we have to avoid
mandatory extra spaces as much as possible.

If a rule had to be set, I would vote for mandatory spaces around
operators, with the benefit of negative lexems (and may be a more
liberal lexing rule for identifiers).

Pierre Weis

INRIA, Projet Cristal,,

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET