From: Pierre Weis <Pierre.Weis@inria.fr>
Message-Id: <199701141959.UAA20575@pauillac.inria.fr>
Subject: Re: Negative float consts
In-Reply-To: <199701141619.RAA12012@arthur.u-strasbg.fr> from Christian Boos at "Jan 14, 97 05:19:19 pm"
To: boos@arthur.u-strasbg.fr (Christian Boos)
Date: Tue, 14 Jan 1997 20:59:17 +0100 (MET)
Hi,
> 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
x+1
and conversely
x-1
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, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET