Core Package v0.1.0
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
| Type | Description |
|---|---|
Result | The return type of an operation that can fail. |
Slice | A view over a contiguous sequence of elements. |
Ranges | The 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
| Function | Description |
|---|---|
Assert | Check a condition at run time, aborting if it fails. |
Panic | Terminate the program immediately with a message. |
#Error | Emit a compilation error. |
#Warn | Emit a compilation warning. |
Compile-time context
| Value | Description |
|---|---|
#target | Information about the compilation target. |
#build | Information about the active build. |
#compiler | Information about the compiler performing the build. |
#config | User-defined values from the manifest and --define. |
#source | Location of the expression that reads it. |
See also
- Conditional Compilation — using the compile-time context in
when - The
ResultType — the recoverable-error model - Slices and Ranges — the language-reference treatment