hermetic

Enforce Eio's capabilities at compile time.

Hermetic is a prelude that restates OCaml's standard library. In a file that opens it, a standard library, Unix or Thread value that reaches the file system, a clock, the network, the standard streams, entropy, a domain or a child process on its own is a type error. This covers Sys too, so Sys.remove and Sys.command are refused. Its alert names the Eio.Stdenv capability to take instead. The unsafe operations that could forge a capability, such as Obj.magic or a Marshal reader, are refused too. A source file opens the prelude on its first line:

open! Hermetic

API

Hermetic is the prelude: the standard library, Unix and Thread, with each refused value given a type nothing consumes and an alert that says why. The Hermetic__ units it aliases hold the restated modules; a program names them through Hermetic, never directly.

The library hermetic depends on the standard library only. The units of the restated Unix and UnixLabels are the library hermetic.unix, which depends on unix, and the unit of the restated Thread is hermetic.threads, which depends on threads. A library that uses Unix or Thread through the prelude names the sub-library among its libraries.