Chapter 8Language extensions

9Overriding in open statements

(Introduced in OCaml 4.01)

definition::= ...  
   open!module-path
 
specification::= ...  
   open!module-path
 
expr::= ...  
 letopen!module-pathin  expr
 
class-body-type::= ...  
   letopen!module-pathin  class-body-type
 
class-expr::= ...  
   letopen!module-pathin  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.