From: Pierre Weis <Pierre.Weis@inria.fr>
To: boos@arthur.u-strasbg.fr (Christian Boos)
Cc: caml-list@inria.fr
Subject: Re: Negative float consts
Date: Tue, 14 Jan 1997 20:59:17 +0100 (MET) [thread overview]
Message-ID: <199701141959.UAA20575@pauillac.inria.fr> (raw)
In-Reply-To: <199701141619.RAA12012@arthur.u-strasbg.fr> from Christian Boos at "Jan 14, 97 05:19:19 pm"
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
prev parent reply other threads:[~1997-01-14 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-14 16:19 Christian Boos
1997-01-14 19:59 ` Pierre Weis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199701141959.UAA20575@pauillac.inria.fr \
--to=pierre.weis@inria.fr \
--cc=boos@arthur.u-strasbg.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).