Core Package v0.1.0

Source
Unstable API
The package is under active development and its API is not yet stable. Names, signatures, and behavior may change between releases, and this documentation will be updated to match.

The core language package: the fundamental types and the compiler intrinsics every program can rely on.

Package: Core

Source: github.com/rux-lang/Rux/tree/main/Packages/Core

Core is the root of the package graph — every other package depends on it. It defines the primitive types, the fundamental generic types (Result, Slice, the ranges), and the compiler intrinsics for diagnostics and for reading the build, compiler, target, and source context at compile time. Its symbols are available without an explicit dependency line.

Installation

Core is an implicit dependency of every package, so it needs no rux add. Import the symbols you use:

import Core::{ Result, Slice };
import Core::{ #target, #Error };

Types

TypeDescription
ResultThe return type of an operation that can fail.
SliceA view over a contiguous sequence of elements.
RangesThe range types produced by the range operators.

The package also defines the primitive types — the signed and unsigned integers, floating-point, boolean, and character families — which are covered in the language reference.

Diagnostics

FunctionDescription
AssertCheck a condition at run time, aborting if it fails.
PanicTerminate the program immediately with a message.
#ErrorEmit a compilation error.
#WarnEmit a compilation warning.

Compile-time context

ValueDescription
#targetInformation about the compilation target.
#buildInformation about the active build.
#compilerInformation about the compiler performing the build.
#configUser-defined values from the manifest and --define.
#sourceLocation of the expression that reads it.

See also