I can’t seem to find the exact meaning of a double-semicolon in an interaction with ocaml. The material here seems to suggest that if they’re placed properly, they should have no impact on the code.
But consider the following:
# let a = 4;; val a : int = 4 # let b = 2;; val b : int = 2
Now let’s add a comment:
# let a = 4;; (* define the name a *) val a : int = 4 # let b = 2;; val b : int = 2 #
Everything still works as expected (both in the toplevel and in a file).
But when that comment extends to a second line, something peculiar happens:
# let a = 4;; (* define the name a val a : int = 4 # for later use *) Warning 2: this is not the end of a comment.
And it’s not that multi-line comments are disallowed, because this works:
# (* define the name a * for later use *) 4;; - : int = 4 #
and so does this:
# let a = 4 (* define * the name a *);; val a : int = 4 #
There’s a clear lesson here – it’s the old joke:
Patient: Doc, it hurts when I do this [moves arm around]
Doctor: Don’t do that!
I should avoid the double-semis. But the quizzical part of me asks, “What the heck is going on with the parsing here?”
Can anyone enlighten me?