* [Caml-list] OCaml 4.02 & {<delim>| in comments
@ 2014-08-02 9:23 Richard W.M. Jones
2014-08-02 9:31 ` David Allsopp
0 siblings, 1 reply; 3+ messages in thread
From: Richard W.M. Jones @ 2014-08-02 9:23 UTC (permalink / raw)
To: caml-list
I came across a strange problem when compiling Coq. The compiler
grumbled about an unterminated string, but pointed me to a comment:
(* between u v = {w|u<=w<=v, w canonical} *)
This was a puzzle, but I added the following patch to Coq to fix it
and moved on.
----------------------------------------------------------------------
--- coq-8.4pl4.old/kernel/univ.ml 2014-04-24 16:13:03.000000000 +0100
+++ coq-8.4pl4/kernel/univ.ml 2014-08-01 11:00:10.447233148 +0100
@@ -226,7 +226,7 @@
(* between : UniverseLevel.t -> canonical_arc -> canonical_arc list *)
-(* between u v = {w|u<=w<=v, w canonical} *)
+(* between u v = { w | u<=w<=v, w canonical } *)
(* between is the most costly operation *)
let between g arcu arcv =
----------------------------------------------------------------------
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?
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] OCaml 4.02 & {<delim>| in comments
2014-08-02 9:23 [Caml-list] OCaml 4.02 & {<delim>| in comments Richard W.M. Jones
@ 2014-08-02 9:31 ` David Allsopp
2014-08-11 8:59 ` Goswin von Brederlow
0 siblings, 1 reply; 3+ messages in thread
From: David Allsopp @ 2014-08-02 9:31 UTC (permalink / raw)
To: Richard W.M. Jones; +Cc: caml-list
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] OCaml 4.02 & {<delim>| in comments
2014-08-02 9:31 ` David Allsopp
@ 2014-08-11 8:59 ` Goswin von Brederlow
0 siblings, 0 replies; 3+ messages in thread
From: Goswin von Brederlow @ 2014-08-11 8:59 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-11 8:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-02 9:23 [Caml-list] OCaml 4.02 & {<delim>| in comments Richard W.M. Jones
2014-08-02 9:31 ` David Allsopp
2014-08-11 8:59 ` Goswin von Brederlow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox