caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Mr. Herr" <misterherr@freenet.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Unary negation parsing
Date: Wed, 2 Dec 2015 22:21:54 +0100	[thread overview]
Message-ID: <565F60F2.8090600@freenet.de> (raw)
In-Reply-To: <CAL4yAN=ZBFh2aCg8uovLdRAzk-4Tm6B1sW+rCQf8tCBE6biz0w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

On 02.12.2015 19:59, Stanislav Artemkin wrote:
> Hi all,
>
> I've just stumbled upon yet another question about unary negation parsing
> (http://stackoverflow.com/questions/34044873/passing-negative-integer-to-a-function-in-ocaml):
>
> let f x = x + 1 in
> f -1
>
> is not valid in OCaml.
>
> I'm just wondering why this issue is still not addressed in the parser? For
> example, F# parses "f -1" as unary negation, but "f - 1" and "f-1" as binary
> operator. It looks a bit tricky (as whitespace is taken into account), but feels so
> natural when writing code.
>
> Is there any reason we can't have the same in OCaml?
>
> PS. I understand that it may break existing code, but it should be solvable by a
> compiler option similar to -safe-string etc.
>
I think this is a non-issue, and it is easily explained to every beginner. And you
say yourself: ... tricky .. whitespace ... may break existing code ...

/Str.



[-- Attachment #2: Type: text/html, Size: 1873 bytes --]

      parent reply	other threads:[~2015-12-02 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 18:59 Stanislav Artemkin
2015-12-02 20:49 ` Gerd Stolpmann
2015-12-03 10:02   ` Stanislav Artemkin
2015-12-02 21:21 ` Mr. Herr [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=565F60F2.8090600@freenet.de \
    --to=misterherr@freenet.de \
    --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).