The include Module.Name
in the module definition will include all the definitions from the module named Module.Name
. Definitions will be included in the same way as they were copied. If include Module.Name
occurs inside a module type definition (aka signature definition), Module.Name
must be a valid (known to the compiler) module type. It will include determining the type of module as such (without including type constraints).
The open Module.Name
, found both in the module implementation and in the module signature, allows you to refer to the definitions (values, types, submodules) of Module.Name
without using a fully qualified name, that is, using short names without the Module.Name
Prefix .
The #require
is not an expression at all and is not part of the OCaml grammar. This is a special OCaml toplevel directive - an interactive loop. The same as ipython has its own directives. The require
directive will load the specified package and all its dependencies. Moreover, this directive is not part of the standard OCaml distribution, but a topfind
script is added, which is part of the ocamlfind toolkit. The #use
directive #use
used to load and evaluate a script. For example, #use "topfind"
load and evaluate a topfind
script from the OCaml standard library library. This script will register the require
directive. There are also #load
and #load_rec
directives that work on a more subtle level, rather than in packages - these directives are designed to load libraries.
source share