Programming Language

Nocter

A self-contained systems language built around simplicity, encapsulation, and foolproof design.

Slices

The compiler-checked slice module contract is the sole authority for exact public declarations on the built-in [T] type. This chapter defines their longer observable behavior without repeating signatures.

Readonly lookup and indexing borrow initialized elements without transferring ownership. Equality, containment, and position compare borrowed elements only when the selected element type supplies the required equality operation. Strict ordering is lexicographic and relies only on the selected element order. Vec<T> reaches these operations through one-step borrow coercions, so direct Vec indexing and slice indexing select the same implementation.

get_range uses half-open element bounds. It returns none when the start exceeds the end or the end exceeds the source length. Empty ranges, including the range at the source end, are valid and retain the source slice's provenance; constructing a range never grants access through a raw address.

Readwrite slices order elements in place with constant auxiliary storage and O(n log n) worst-case comparisons and moves. No later element is strictly less than an earlier element after sorting. Equivalent elements may change relative order. Rearrangement transfers values without copying or destroying them. Sorting requires the element type's explicit TotalOrder guarantee; the existence of < alone is insufficient because it may describe a partial comparison. The selected comparison may allocate or trap, so the operation does not claim a transitive noalloc guarantee.

Pointer observation returns a non-owning address and grants no additional access or lifetime. Internal raw-view construction remains package-private and is not a public slice operation.