Spec-Zone.ru › OCaml
☰The OCaml language
  • The OCaml language
  • Language extensions

Chapter 12 Language extensions

9 Overriding in open statements

(Introduced in OCaml 4.01)

definition ::= ...
∣ open! module-path
specification ::= ...
∣ open! module-path
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

Since OCaml 4.01, open statements shadowing an existing identifier (which is later used) trigger the warning 44. Adding a ! 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.

« Type-level module aliasesGeneralized algebraic datatypes »
Copyright © 2026 Institut National de Recherche en Informatique et en Automatique

© 1995-2026 INRIA.
https://ocaml.org/manual/5.5/overridingopen.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API