caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] OCaml 4.02 & {<delim>| in comments
Date: Mon, 11 Aug 2014 10:59:16 +0200	[thread overview]
Message-ID: <20140811085916.GC6277@frosties> (raw)
In-Reply-To: <E62F368A-A2CB-4E58-B3E8-E280660A84C4@metastack.com>

On Sat, Aug 02, 2014 at 09:31:01AM +0000, David Allsopp wrote:
> 
> > Today I was reading about the new ppx extensions, and now I understand
> > that {<delim>| is the syntax used for quoted strings.  Puzzle solved!
> > 
> > However my question is: Is it a bug that the compiler complains about
> > {<delim>| inside a comment?
> 
> It'll be for the same reason as parentheses and quote marks must already match... it allows for nested (* ... *) unlike /* ... */ in C.
> 
> 
> David

Or in other words: Ocaml comments are designed so that valid code can
be commented out by surounfing it in (* ... *). That includes strings
containing e.g. "*)":

# let x = 1 (* "*)" *);;
val x : int = 1

For that to work the inside of comments need to be parsed for strings
and such.

MfG
	Goswin

      reply	other threads:[~2014-08-11  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-02  9:23 Richard W.M. Jones
2014-08-02  9:31 ` David Allsopp
2014-08-11  8:59   ` Goswin von Brederlow [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=20140811085916.GC6277@frosties \
    --to=goswin-v-b@web.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).