Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
all uppercase polymorphic variants cannot be parsed when camlp4.macro is enabled #4732
Original bug ID: 4732
Looks like there is a conflict between cpp-like macros (as enabled by the camlp4.macro package) and all uppercase polymorphic variants.
I've set severity major, because this bug currently inhibit using camlp4 with libraries which require all uppercase macros in their API. A notable example is lablgtk2, which uses stuff like
Here is how to reproduce (using findlib):
$ ledit ocaml
Findlib has been successfully loaded. Additional directives:
`IN;; (* plain camlp4, works fine *)
`IN;; (* no longer works *)
Error: Parse error: [a_ident] expected after "`" (in [expr])
`In;; (* if we renounce to all uppercase, it works again :-/ *)
Comment author: zack
Actually, the bug title is misleading. It is not the case that all uppercase polymorphic variants cannot be parser, but only `IN (which is possibly a keyword for the new camlp4).
Nevertheless the problem stands, partly because
Comment author: Richard Jones
Also `END cannot be parsed.
This is annoying in lablgtk2 programs where `END is used as a packing hint.
You can work around the bug like this:
Printf.printf "%d\n" (Obj.magic `END : int) ;;
then in the program replace this: