Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005745OCamlOCaml generalpublic2012-08-29 12:022012-09-04 15:58
Assigned Togasche 
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version3.12.1 
Target VersionFixed in Version 
Summary0005745: string literals inside comments
DescriptionOcaml parser doesn't ignores quotes inside comments and requires all quotations to be closed.


$ echo '(* "test *)' | ocaml
        Objective Caml version 3.12.1
# (* "test *)
# *
Error: This comment contains an unterminated string literal


$ echo '(* "test" *)' | ocaml
        Objective Caml version 3.12.1

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2012-08-29 12:08

I'm not sure why this well-known behavior should be considered a bug. It is occasionally surprising but also useful (and easy to check with syntax colouring). Are you suggesting a particular change or improvement to the documentation?
johnlepikhin (reporter)
2012-08-30 12:26

Well, I use Ocaml in my daily work for 5 years, but seems like that was the first day when I tried to add unclosed quotation mark into comment :) Your response is surprised me. I think it's time to close this bug.
meyer (developer)
2012-09-03 04:17

We should provide escape of the single in form of \". Tools like ocamldoc or ocamlweb extract comments, and taken that " means inch in imperial units, it's fairly possible to hit the undesired behavior. There is an obvious workaround for that to use '' or special markup escapes.
gasche (developer)
2012-09-04 15:58

In retrospect I guess that my initial answer was a bit harsh. johnlepikhin, I'm sorry for that.

I understand that not everyone knows about this and that it can be surprising. I don't think we should change this (the risk of introducing a backward-incompatible lexer bug seems greater than the benefits), especially since there is already a rather explicit error raised in this case.

If you want to use a single " inside a comment, I recommend '' as a workaround.

I'm marking the bug as "resolved" to get it out the of hot list. If someone (meyer?) is strongly convinced that there is a better solution, don't hesitate to comment.

- Issue History
Date Modified Username Field Change
2012-08-29 12:02 johnlepikhin New Issue
2012-08-29 12:08 gasche Note Added: 0007992
2012-08-29 12:08 gasche Status new => feedback
2012-08-30 12:26 johnlepikhin Note Added: 0007993
2012-08-30 12:26 johnlepikhin Status feedback => new
2012-09-03 04:17 meyer Note Added: 0008007
2012-09-04 15:58 gasche Note Added: 0008019
2012-09-04 15:58 gasche Status new => resolved
2012-09-04 15:58 gasche Resolution open => no change required
2012-09-04 15:58 gasche Assigned To => gasche

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker