[wg-camlp4] A new branch to experiment with extension points

Alain Frisch alain.frisch at lexifi.com
Mon Mar 4 17:57:05 GMT 2013

Current state of the SVN branch:

Attributes on expressions, module expressions, types, patterns, module 
type expressions:

   postfix syntax: ... [@id expr]
   prefix syntax:  [^id expr] ...

Extensions on the same categories:

   [#lid expr]

Attributes on constructor declarations (needed for constant 
constructors, in particular):

  type t =
    | A [@id expr] [@id expr]
    | B [@id expr] [@id expr] of ...

"Item" attributes:

  postfix syntax:   ... [@@id expr]
  prefix syntax:    [^^id expr] ...

  Currently available on most kind of declarations/statements in 
signatures (except class and class types), and on some kinds of 
declarations in structures (exception declaration, open, include, types)

Example of a signature:

   [^^doc section "My functions"] include sig
      val foo: int -> int [@@since "3.01"]

      type t = A [@default] | B of (int [@init 10]) * s
           [@@doc "A type with two constructors"]

      and  [^^deprecated] s = {x : int [@init 1]; y : int [@init 2]}
           [@@doc "A record type"]

      include S
      [@@doc inline]

-- Alain

More information about the wg-camlp4 mailing list