package b0

  1. Overview
  2. Docs
Module type
Class type

Scopes are used to track and scope B0 definitions created by libraries and B0 files.

type t

The type for scopes.

Library scopes

val lib : string -> unit

lib l sets up a scope for library l. Must be called before making any static definition in a library. FIXME example.

B0 file scopes

Note. This is used by the implementation of the driver API, if you are fiddling with this you are likely doing something wrong.

val root : B0_std.Fpath.t -> unit

root file initializes B0 file scoping for the root B0 file at the absolute file path file.

This installs a Printexc.set_uncaught_exception_handler to handle uncaught and Duplicate. If that happens the error is logged and the program exits with B0_driver.Exit.b0_file_error.

val open' : string -> B0_std.Fpath.t -> unit

open' name opens scope name to add the definitions of the absolute file path file.

Warning. Scope unicity is not checked by the module this is expected to be handled by the client.

val close : unit -> unit

close () closes the last open'ed scope.

Definition sealing

val seal : unit -> unit

seal () prevents further definitions from being made. This function is called at the end of the root B0 file.

exception After_seal of string

Exception thrown if a definition is made after seal was invoked. The argument is an error message to print. The backtrace should point to the location of the illegal definition.


Innovation. Community. Security.