Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: Tom Ridge <tom.j.ridge+list@googlemail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: RE: [Caml-list] Comment syntax?
Date: Wed, 14 Sep 2016 13:11:04 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D901351A1B8B@Remus.metastack.local> (raw)
In-Reply-To: <CABooLwOu_xA+ubyUGVQOOGz1fey0=JRCAFK=Y5Bo3mt1zN1eSg@mail.gmail.com>

Tom Ridge wrote:
> Isn't this rather complicated? 

Complicated? It's a trade-off, sure. Very occasionally (usually when writing comments about parsers) one is forced to insert an unexpected symbol into a comment in order to satisfy the parser.

> In this case, has there been any progress on "single line" comments eg 
>
> // some comment
> 
> ? I think this was mentioned recently on the list. 
> (I am also aware that // is verboten for some reason).

// is "verboten" because it is already available as an operator, so using it as a comment would break existing code.

> It seems to me that multiline comments are a poor design choice. Single line
> comments permit commenting arbitrary blocks (just prepend each line with
> "//"), and play well with nested comments (no problem if a line starts
> "// //" etc). Also, they are very simple to implement in the lexer.

A nice feature of nestable multiline comments which you don't get with only single-line comments is that you do actually know where the end of the commented block is. The fact OCaml uses a bracket even means you get matching without any extra support in editors (% in Vim, etc.) :o) 

> Please can we have support for simple (ie from the token "//" to the end-of-
> line, no messing with string literals etc) single line comments?

https://github.com/ocaml/ocaml/pull/671

I'm not sure I agree that having multiline comments is a poor design choice, but I agree it would (very occasionally) be nice to have single-line comments as well.


David

(PS While I don't believe that all top-posting is evil, these threads read back better in archives when bottom-posted...) 

      parent reply	other threads:[~2016-09-14 13:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 12:34 Tom Ridge
2016-09-14 12:38 ` David Allsopp
2016-09-14 12:51   ` Tom Ridge
2016-09-14 13:04     ` Jeremy Yallop
2016-09-14 13:11     ` David Allsopp [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=E51C5B015DBD1348A1D85763337FB6D901351A1B8B@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@inria.fr \
    --cc=tom.j.ridge+list@googlemail.com \
    /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