summaryrefslogtreecommitdiff
path: root/experimental
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-07-22 14:04:28 +0000
committerAlain Frisch <alain@frisch.fr>2013-07-22 14:04:28 +0000
commit8df2057b4662c16eb6f09d403e784770a26caea3 (patch)
tree99cb2867dae8f3d8a128029eda44314c5fdf6f07 /experimental
parent525ef9d7035faa15f872af802f2998cd696977e2 (diff)
downloadocaml-8df2057b4662c16eb6f09d403e784770a26caea3.tar.gz
Special syntax when the payload of attribute/extension is a single type expression: [@id : T], [%id : T]. Represented internally as (() : T).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13918 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'experimental')
-rw-r--r--experimental/frisch/extension_points.txt26
1 files changed, 18 insertions, 8 deletions
diff --git a/experimental/frisch/extension_points.txt b/experimental/frisch/extension_points.txt
index ed7fc20613..1fa7e9c66c 100644
--- a/experimental/frisch/extension_points.txt
+++ b/experimental/frisch/extension_points.txt
@@ -4,16 +4,26 @@ This file describes the changes on the extension_points branch.
=== Attributes
Attributes are "decorations" of the syntax tree which are ignored by
-the type-checker. An attribute is made of an identifier (written id)
-and a argument, which is an OCaml structure (i.e. a list of structure
-items), written s below.
+the type-checker. An attribute is made of an identifier (written id below)
+and a payload (written s below).
-The identifier can be a lowercase or uppercase identifier (including
-OCaml keywords) or a sequence of such atomic identifiers separated with
-a dots (whitespaces are allowed around the dots). In the Parsetree,
-the identifier is represented as a single string (without spaces).
+ * The identifier 'id' can be a lowercase or uppercase identifier
+ (including OCaml keywords) or a sequence of such atomic identifiers
+ separated with a dots (whitespaces are allowed around the dots).
+ In the Parsetree, the identifier is represented as a single string
+ (without spaces).
+
+ * The payload 's' is an OCaml structure (i.e. a list of structure items).
+ Note that a payload can be empty or reduced to a single expression
+ (both cases are valid structures). To support attributes whose
+ payload needs to be a type expression, the special syntax:
+
+ : T
+
+ (where T is a type expression) is also accepted as a valid payload,
+ and is interpreted internally as the structure made of the single
+ expression (() : T).
-Note: a structure can be empty, or reduced to a single expression.
Attributes on expressions, type expressions, module expressions, module type expressions,
patterns, class expressions, class type expressions: