Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004732OCamlCamlp4public2009-02-26 23:522012-09-25 20:06
Reporterzack 
Assigned Toertai 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0 
Target VersionFixed in Version3.12.1+dev 
Summary0004732: all uppercase polymorphic variants cannot be parsed when camlp4.macro is enabled
DescriptionLooks 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 `IN, `OUT, ...

Here is how to reproduce (using findlib):

$ ledit ocaml
        Objective Caml version 3.11.0

# #use "topfind";;
Findlib has been successfully loaded. Additional directives:
  #require "package";; to load a package
  #list;; to list the available packages
  #camlp4o;; to load camlp4 (standard syntax)
  #camlp4r;; to load camlp4 (revised syntax)
  #predicates "p,q,...";; to set these predicates
  Topfind.reset();; to force that packages will be reloaded
  #thread;; to enable threads

# #camlp4o;;
/usr/lib/ocaml/3.11.0/dynlink.cma: loaded
/usr/lib/ocaml/3.11.0/camlp4: added to search path
/usr/lib/ocaml/3.11.0/camlp4/camlp4o.cma: loaded
        Camlp4 Parsing version 3.11.0

# `IN;; (* plain camlp4, works fine *)
- : [> `IN ] = `IN
# #require "camlp4.macro";;
/usr/lib/ocaml/3.11.0/camlp4/Camlp4Parsers/Camlp4MacroParser.cmo: loaded
# `IN;; (* no longer works *)
Error: Parse error: [a_ident] expected after "`" (in [expr])
# `In;; (* if we renounce to all uppercase, it works again :-/ *)
- : [> `In ] = `In
#
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004843)
zack (reporter)
2009-02-27 10:14

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 `IN is used by libraries out there (e.g. lablgtk2), partly because the bug appears only when you use the camlp4.macro package, which makes harder for library published to know they should refrain from using `IN.
(0004845)
Christophe Troestler (reporter)
2009-03-01 19:25

The "IN" comes from local macros "DEFINE ... IN ...". For now, you may want to use Delimited overloading http://forge.ocamlcore.org/projects/pa-do/ [^] macros which does not have that problem.
(0005743)
Richard Jones (reporter)
2010-12-17 10:57
edited on: 2010-12-17 11:09

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) ;;
3448763

then in the program replace this:

    hbox#pack ~from:`END

with this:

    let from = Obj.magic 3448763 in
    hbox#pack ~from


- Issue History
Date Modified Username Field Change
2009-02-26 23:52 zack New Issue
2009-02-27 10:14 zack Note Added: 0004843
2009-03-01 19:25 Christophe Troestler Note Added: 0004845
2009-03-28 17:40 xleroy Status new => assigned
2009-03-28 17:40 xleroy Assigned To => ertai
2010-12-17 10:57 Richard Jones Note Added: 0005743
2010-12-17 11:09 Richard Jones Note Edited: 0005743
2011-05-11 10:59 xclerc Status assigned => resolved
2011-05-11 10:59 xclerc Fixed in Version => 3.12.1+dev
2011-05-11 10:59 xclerc Resolution open => fixed
2012-09-25 20:06 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker