bootstrap

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package bootstrap performs initial setup of the Ale runtime environment. It populates a new Environment with all core functions, macros, special forms, and standard library definitions. Create a new `*env.Environment` and pass it to `Into` to initialize a complete Ale runtime ready for code evaluation.

Index

Constants

View Source
const (
	ErrCannotDeclareFS = "failed to declare filesystem: %w"
	ErrCannotBindFS    = "failed to bind filesystem: %w"
)

Error messages

View Source
const (
	// ErrBuiltInNotFound is raised when a built-in procedure can't be resolved
	ErrBuiltInNotFound = "built-in not found: %s"

	// ErrSpecialNotFound is raised when a built-in special can't be resolved
	ErrSpecialNotFound = "special form not found: %s"

	// ErrMacroNotFound is raised when a built-in macro can't be resolved
	ErrMacroNotFound = "macro not found: %s"
)
View Source
const InitFile = "bootstrap.ale"

Variables

This section is empty.

Functions

func BindFileSystem added in v0.3.0

func BindFileSystem(ns env.Namespace, f fs.FS) error

BindFileSystem binds a file system to a Namespace to enable source includes and other file operations. The file system is private to the Namespace

func DevNull

func DevNull(e *env.Environment)

DevNull binds *in*, *out*, and *err* to the operating system's bit bucket device (usually /dev/null)

func DevNullEnvironment

func DevNullEnvironment() *env.Environment

DevNullEnvironment configures a bootstrapped environment completely isolated from the top-level of the system. All I/O is rerouted to and from the operating system's bit bucket device (usually /dev/null)

func Into

func Into(e *env.Environment)

Into sets up initial built-ins and populateAssets. Useful if you're wiring up your own Environments. Otherwise, calls to TopLevelEnvironment and DevNullEnvironment will perform this action for you.

func MustBindFileSystem added in v0.3.0

func MustBindFileSystem(ns env.Namespace, f fs.FS)

MustBindFileSystem binds a file system to a Namespace or panics if it can't

func ProcessArgs

func ProcessArgs(e *env.Environment)

ProcessArgs binds *args* to the current Go app's command line arguments

func ProcessEnv

func ProcessEnv(e *env.Environment)

ProcessEnv binds *env* to the operating system's environment variables

func StandardIO

func StandardIO(e *env.Environment)

StandardIO binds *in*, *out*, and *err* to the operating system's standard input and output facilities

func TopLevelEnvironment

func TopLevelEnvironment() *env.Environment

TopLevelEnvironment configures an environment that could be used at the top-level of the system, such as the REPL. It has access to the *env*, *args*, and operating system's standard in/out/err file streams.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL