Unexpected comments behavior

Strings have to be closed, even if they appear in comments: this restriction allows arbitrary code to be commented properly. For instance, suppose you want to comment the following code:

print_endline "*)"

The commented version will be:

(* print_endline "*)" *)

There is an occurrence of *) inside the comment, which is ignored because it occurs inside a string.

Similarly, in the following comment, the first occurrence of *) is ignored as it occurs inside a string.

(* Never use an odd number of " in your comment *)"*)