Skip to main content

Module stdlib

Module stdlib 

Source
Expand description

The standard library: Cove source embedded in the compiler binary.

cove_schema::builtins::STANDARD_LIBRARY names which builtin methods have moved out of Rust and into Cove, and points at the module each one lives in. This module is where that module’s source actually is: crates/cove-sema/std/*.cove, read into the binary with include_str! so a checked program never depends on a file existing on disk at some path relative to the running cove.

§This is the precompile boundary

attach parses the embedded source into the caller’s SourceMap every time it is called, exactly as parsing any other module does. That is deliberate and temporary: nothing about the standard library changes between runs, so the day it is warm enough to matter, this is the one function that changes — to answer a cached checked Program or cached IR instead of parsing from scratch — and every caller stays as it is. Do not build that cache before there is a measurement asking for it; the point of writing it down here is that nothing outside this function has to know when it arrives.

Functions§

attach
See the module doc for what this function is allowed to become without its callers changing.
install
Adds the standard library’s sources to sources and answers the modules to put in a package.
module_names
Every module name the standard library declares.