diff options
author | alainfrisch <alain@frisch.fr> | 2017-07-19 14:46:22 +0200 |
---|---|---|
committer | alainfrisch <alain@frisch.fr> | 2017-07-19 14:46:22 +0200 |
commit | 78cbb8ec63754280d0575f164001a66068be8cf7 (patch) | |
tree | 7f99d0ff1a3c99bef1dcd69b49bd1a8588682230 | |
parent | 59ef4405ab7f62f90f594ee60dd932c317f45a78 (diff) | |
download | ocaml-let_open_in_classes.tar.gz |
Manual.let_open_in_classes
-rw-r--r-- | manual/manual/refman/classes.etex | 9 | ||||
-rw-r--r-- | manual/manual/refman/exten.etex | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/manual/manual/refman/classes.etex b/manual/manual/refman/classes.etex index d9f27d7402..2480357c9f 100644 --- a/manual/manual/refman/classes.etex +++ b/manual/manual/refman/classes.etex @@ -27,6 +27,7 @@ class-type: class-body-type: 'object' ['(' typexpr ')'] {class-field-spec} 'end' | ['[' typexpr {',' typexpr} ']'] classtype-path + | 'let' 'open' module-path 'in' class-body-type ; %\end{syntax} \begin{syntax} class-field-spec: @@ -75,6 +76,10 @@ virtual method will match a concrete method, which makes it possible to forget its implementation. An immutable instance variable will match a mutable instance variable. +\subsubsection*{Local opens} + +Local opens are supported in class types since OCaml 4.06. + \subsubsection*{Inheritance} \ikwd{inherit\@\texttt{inherit}} @@ -173,6 +178,7 @@ class-expr: | 'fun' {{parameter}} '->' class-expr | 'let' ['rec'] let-binding {'and' let-binding} 'in' class-expr | 'object' class-body 'end' + | 'let' 'open' module-path 'in' class-expr ; %BEGIN LATEX \end{syntax} \begin{syntax} @@ -258,6 +264,9 @@ definition, it will be evaluated when the class is created (just as if the definition was outside of the class). Otherwise, it will be evaluated when the object constructor is called. +\subsubsection*{Local opens} + +Local opens are supported in class expressions since OCaml 4.06. \subsubsection*{Class\label{ss:class-body} body} \begin{syntax} diff --git a/manual/manual/refman/exten.etex b/manual/manual/refman/exten.etex index 0fee6f5fc3..4b4ddb2e76 100644 --- a/manual/manual/refman/exten.etex +++ b/manual/manual/refman/exten.etex @@ -1020,6 +1020,15 @@ specification: expr: ... | 'let' 'open!' module-path 'in' expr +; +class-body-type: + ... + | 'let' 'open!' module-path 'in' class-body-type +; +class-expr: + ... + | 'let' 'open!' module-path 'in' class-expr +; \end{syntax} Since OCaml 4.01, @"open"@ statements shadowing an existing identifier @@ -1027,6 +1036,8 @@ Since OCaml 4.01, @"open"@ statements shadowing an existing identifier character after the @"open"@ keyword indicates that such a shadowing is intentional and should not trigger the warning. +This is also available (since OCaml 4.06) for local opens in class +expressions and class type expressions. \section{Generalized algebraic datatypes} \ikwd{type\@\texttt{type}} \ikwd{match\@\texttt{match}} \label{s:gadts} |