Module B0_def

B0 definitions.

B0 definitions are uniquely named OCaml values of different types used for describing software construction. The value names are used for end-user interaction.

B0 definitions occur in various B0 files and libraries during the module initialisation phase of the program consuming the definitions. After the module initialisation phase no new definition is allowed.

This module handle the management of these named values in B0 files and libraries. It provides the infrastructure to track the location of their definition, properly scope the names, check their unicity in the scope, index them and make sure they cannot be defined after the module initialisation phase of the program.


type t

The type for definition names and their scoping information.

type def = t

See t.

val scope : t -> B0_scope.t

scope d is the scope in which d is defined.

val file : t -> B0_std.Fpath.t option

file d is the absolute file path in which d is defined, if defined in a file.

val scope_dir : t -> B0_std.Fpath.t option

scope_dir is the parent of file d.

val name : t -> string

name d is the qualified name of d.

val doc : t -> string

doc d is a one-line documentation string for d.

val meta : t -> B0_meta.t

meta is the metadata associated to the definition.

Defining values

module type VALUE = sig ... end

The type for values to be named.

module type S = sig ... end

The type of named values.

module Make (V : VALUE) : S with type t = V.t

Make (V) names the values of V.

type value =
  1. | V : (module S with type t = 'a) * 'a -> value