slovo/lib/std/README.md

664 lines
43 KiB
Markdown

# Slovo Standard Library Source Layout Alpha
Release: established by `exp-30`, Standard Library Source Layout Alpha;
wrappers updated through `exp-31`, `exp-34`, `exp-37`, and `exp-38`; math
helpers updated through `exp-39`, `exp-56`, and `exp-57`; result helpers
updated through `exp-35`, `exp-74`, `exp-109`, and the final `exp-125`
unsigned precursor scope now absorbed into `1.0.0-beta`; option helpers
updated through `exp-36`, `exp-75`, `exp-95`, `exp-100`, `exp-102`,
`exp-109`, and the final `exp-125` unsigned precursor scope now absorbed into
`1.0.0-beta`;
explicit `std.math` source search
promoted in `exp-44`; explicit `std.result` and `std.option` source search
promoted in `exp-45`; workspace-package standard source search promoted in
`exp-46`; explicit host facade source search promoted in `exp-47`; explicit
core facade source search promoted in `exp-48`; explicit IO facade source
search promoted in `exp-49`; installed standard-library discovery promoted in
`exp-50`; ordered `SLOVO_STD_PATH` path-list discovery promoted in `exp-51`;
explicit process facade source search promoted in `exp-52`; explicit CLI
facade source search promoted in `exp-53`; io value helpers updated through
`exp-73`; io stdin helpers updated through `exp-111`; typed CLI argument
helpers updated through `exp-54`, `exp-55`, and `exp-72`; CLI option helpers
updated through `exp-110`; CLI local-source gate
aligned in `exp-78`; string fallback helpers updated through `exp-60` and
`exp-68`; string option helpers updated through `exp-110`; string
byte-scanning and token-boundary helpers updated in `1.0.0-beta.16`; string
search and ASCII trim helpers updated in `1.0.0-beta.20`; process fallback
helpers updated through `exp-61`; process typed helpers updated through
`exp-67` and `exp-71`; process option helpers updated through `exp-110`; env
fallback helpers updated through `exp-62` and `exp-69`; env typed helpers
updated through `exp-65`; env option helpers updated through `exp-110`; fs
fallback helpers updated through `exp-63` and `exp-70`; fs typed read helpers
updated through `exp-66`; fs option helpers updated through `exp-110`; num
fallback helpers updated through `exp-64`; concrete vec helpers updated
through `1.0.0-beta.12`, including the current concrete
`std/vec_string.slo`, `std/vec_f64.slo`, and `std/vec_bool.slo`
prefix/suffix helper scopes, `std/vec_i64.slo` query and prefix/suffix parity,
and `std/vec_f64.slo` query parity; `1.0.0-beta.6` networking foundation work releases
`std/net.slo` as an experimental loopback TCP facade over matching
compiler-known runtime calls; `1.0.0-beta.7` serialization work releases
`std/json.slo` as an experimental JSON text-construction facade over
`std.json.quote_string` and existing string/number helpers; the Slovo-facing
`1.0.0-beta.17` JSON foundation adds primitive scalar token parse facades for
booleans, concrete numeric primitives, and exact `null`; the Slovo-facing
`1.0.0-beta.18` JSON foundation adds one ASCII string-token parse
facade; the `1.0.0-beta.21` JSON foundation adds source-authored
whole-document scalar parse facades over `std.string.trim_ascii` and the
existing exact value-token parsers; the
`1.0.0-beta.8` concrete type alias target keeps that same helper surface while
using local `JsonText` and `JsonField` aliases as transparent names for
`string` JSON fragments; `1.0.0-beta.23` adds the public
standard-library stability tier ledger without changing this helper surface.
This directory is the source home for staged standard library modules and
examples. exp-44 lets project-mode source explicitly import `std/math.slo` as
`(import std.math (...))`; exp-45 extends that model to `std/result.slo` and
`std/option.slo`; exp-46 extends explicit source search to workspace packages;
exp-47 extends project-mode source search to `std/time.slo`,
`std/random.slo`, `std/env.slo`, and `std/fs.slo`; exp-48 extends
project-mode source search to `std/string.slo` and `std/num.slo`; exp-49
extends project-mode source search to `std/io.slo`; exp-73 extends that
facade with value-returning print wrappers; exp-111 extends it again with
stdin source helpers over `std.io`, `std.string`, and `std.result`; exp-50
lets explicit
standard-source imports find those staged files from installed
`share/slovo/std` layouts; exp-51 lets `SLOVO_STD_PATH` name an ordered OS
path list of standard-library roots; exp-52 extends project-mode source
search to `std/process.slo`; exp-53 extends project-mode source search to
`std/cli.slo`, a source-authored facade that imports `std.process` and
`std.string`; exp-54 extends that facade with typed argument parse helpers;
exp-55 makes the f64 and bool helpers result-based for missing argument
indexes; exp-72 extends that facade with typed custom-fallback helpers over
those same argument and parse result families; exp-78 records that unchanged
CLI helper surface as the Slovo-side contract for the sibling Glagol
local-source gate without widening `std.cli`; exp-60 extends `std/string.slo`
with source-authored parse fallback
helpers over the already promoted concrete parse result families; exp-61
extends `std/process.slo` with source-authored string fallback helpers over
`arg_result`; exp-62 extends `std/env.slo` with source-authored presence and
custom-fallback helpers over `get_result`; exp-63 extends `std/fs.slo` with
source-authored text fallback/status helpers over the current filesystem
result families; exp-64 extends `std/num.slo` with source-authored checked
conversion fallback helpers over the current numeric result families; exp-65
extends `std/env.slo` with typed parse result/fallback helpers over
environment lookup plus the existing concrete parse result families; exp-66
extends `std/fs.slo` with typed read result/fallback helpers over
`read_text_result` plus the existing concrete parse result families; exp-67
extends `std/process.slo` with typed argument result/fallback helpers over
`arg_result` plus the existing concrete parse result families; exp-68 extends
`std/string.slo` with typed parse custom-fallback helpers over those same
concrete parse result families; exp-69 extends `std/env.slo` with typed parse
custom-fallback helpers over environment lookup plus those same concrete parse
result families; exp-70 extends `std/fs.slo` with typed read custom-fallback
helpers over `read_text_result` plus those same concrete parse result
families; exp-71 extends `std/process.slo` with typed argument custom-fallback
helpers over `arg_result` plus those same concrete parse result families;
post-`1.0.0-beta.1` main extends `std/fs.slo` with read-only text
resource-handle helpers over `std.fs.open_text_read_result`,
`std.fs.read_open_text_result`, and `std.fs.close_result`, plus narrow
filesystem status/mutation helpers over `std.fs.exists`, `std.fs.is_file`,
`std.fs.is_dir`, `std.fs.remove_file_result`, and
`std.fs.create_dir_result`, while keeping handles beta-scoped opaque `i32`
values and leaving directory enumeration deferred;
`1.0.0-beta.6` releases `std/net.slo` as an experimental blocking
loopback TCP facade over `std.net.tcp_connect_loopback_result`,
`std.net.tcp_listen_loopback_result`, `std.net.tcp_bound_port_result`,
`std.net.tcp_accept_result`, `std.net.tcp_read_all_result`,
`std.net.tcp_write_text_result`, and `std.net.tcp_close_result`, while keeping
socket handles beta-scoped opaque `i32` values and leaving DNS, TLS, async,
UDP, non-loopback binding, and stable ABI/layout deferred;
`1.0.0-beta.7` releases `std/json.slo` as an experimental compact JSON
text-construction facade over `std.json.quote_string`, `std.string.concat`,
and the current `std.num.*_to_string` helpers. The Slovo-facing
`1.0.0-beta.17` JSON foundation adds exact primitive scalar token parse
facades over promoted `std.json` bool/numeric runtime helpers and an exact
source-only `null` token helper. The `1.0.0-beta.18` JSON foundation
adds `parse_string_value_result` for one already-isolated ASCII JSON string
token over the matching promoted runtime helper. The
`1.0.0-beta.21` JSON foundation adds source-authored
`parse_*_document_result` helpers for string, bool, concrete numeric
primitives, and exact `null` by trimming ASCII whitespace around the whole
document and delegating to those exact value-token parsers. Object/array
parsing, recursive JSON values, maps/sets, streaming decoders or encoders,
schema validation, Unicode escape decoding/normalization beyond the existing
string-token behavior, embedded NUL policy, and stable text encoding policy
remain deferred;
`1.0.0-beta.8` targets top-level concrete type aliases in source facades and
uses `JsonText` / `JsonField` only as local transparent aliases inside
`std/json.slo` and matching local JSON fixtures. These aliases are not exported
standard-library names and do not add runtime helpers, generic aliases,
parameterized aliases, maps/sets, or ABI/layout guarantees;
exp-76 extends project-mode source search to `std/vec_i32.slo`, a concrete
source-authored collection facade over the current promoted `std.vec.i32`
runtime family; exp-77 extends that facade with concrete option-returning
query helpers over the current `(option i32)` family via `std.option`;
exp-79 extends it with narrow recursive transform helpers over that same
concrete vec family; exp-80 extends it with narrow generated constructor
helpers over that same concrete vec family; exp-81 adds one public `range`
helper over that same concrete vec family; exp-82 adds one public
`replace_at` helper over that same concrete vec family; exp-83 adds one
public `remove_at` helper over that same concrete vec family; exp-84 adds
one public `insert_at` helper over that same concrete vec family; exp-85
adds one public `subvec` helper over that same concrete vec family; exp-86
adds one public `remove_range` helper over that same concrete vec family;
exp-87 adds one public `insert_range` helper over that same concrete vec
family; exp-88 adds one public `replace_range` helper over that same
concrete vec family; exp-89 adds one public `starts_with` helper over
that same concrete vec family; exp-90 adds one public `ends_with`
helper over that same concrete vec family; exp-91 adds one public
`without_suffix` helper over that same concrete vec family; and exp-92 adds
one public `without_prefix` helper over that same concrete vec family; exp-93
adds one public `count_of` helper over that same concrete vec family; exp-94
stages `std/vec_i64.slo` as a concrete source-authored `(vec i64)` baseline
facade over the sibling `std.vec.i64` runtime family; exp-96 extends that
same facade with concrete option-query helpers over raw current option forms;
exp-97 extends it with recursive immutable transform helpers plus `subvec`;
exp-98 adds connected immutable edit helpers over that same helper surface;
and exp-99 stages `std/vec_string.slo` as a concrete source-authored
`(vec string)` baseline facade over the sibling `std.vec.string` runtime
family; exp-103 stages `std/vec_f64.slo` as a concrete source-authored
`(vec f64)` baseline facade over the sibling `std.vec.f64` runtime family;
exp-104 stages `std/vec_bool.slo` as a concrete source-authored
`(vec bool)` baseline facade over the sibling `std.vec.bool` runtime family;
exp-108 broadens all three non-i32 concrete collection lanes with one
connected prefix/suffix helper package; and `1.0.0-beta.12` fills concrete
vector source parity by adding `count_of`, `starts_with`, `without_prefix`,
`ends_with`, and `without_suffix` to `std/vec_i64.slo`, plus `count_of` to
`std/vec_f64.slo`, matching the existing concrete lane behavior for empty
prefixes/suffixes, mismatches, exact removals, and repeated exact counts.
It does not
make the standard library fully self-hosted, does not add automatic
standard-library imports, and does not replace the compiler-known `std.*`
standard-runtime calls cataloged in `../STANDARD_RUNTIME.md`.
`docs/language/STDLIB_API.md` remains the generated exact signature catalog
for exported helpers in this directory. `docs/language/STDLIB_TIERS.md` is the
beta23 public maturity ledger for that catalog. It defines the tier labels
`beta-supported`, `experimental`, and `internal`; classifies JSON, loopback
networking, random/time, and filesystem resource-handle helpers as
experimental domains; and records the concrete vector modules as
beta-supported concrete lanes, not a generic collections freeze. The tier
ledger is documentation/catalog tooling clarity only and does not add helpers,
syntax, runtime behavior, stable Markdown schema, or a stable stdlib/API
freeze. The generated catalog and release gate now expose and check tier
metadata.
The current `.slo` files use flat module declarations such as `(module math)`.
For exp-44, exp-45, exp-47, exp-48, exp-49, exp-52, exp-53, exp-76, exp-94,
exp-96, exp-97, exp-98, exp-99, exp-103, exp-104, exp-105, exp-107, exp-108,
`1.0.0-beta.12`, and `1.0.0-beta.16`, `std/math.slo`, `std/result.slo`,
`std/option.slo`, `std/time.slo`, `std/random.slo`, `std/env.slo`,
`std/fs.slo`, `std/net.slo`, `std/json.slo`, `std/string.slo`, `std/num.slo`,
`std/io.slo`, `std/process.slo`, `std/cli.slo`, `std/vec_i32.slo`,
`std/vec_f64.slo`, `std/vec_i64.slo`, and `std/vec_string.slo` carry explicit
export lists.
Glagol may address them externally as `std.math`, `std.result`,
`std.option`, `std.time`, `std.random`, `std.env`, `std.fs`, `std.string`,
`std.net`, `std.json`, `std.num`, `std.io`, `std.process`, `std.cli`, `std.vec_i32`,
`std.vec_f64`, `std.vec_bool`, `std.vec_i64`, and `std.vec_string`.
The file layout is the contract:
- `std/cli.slo`
- `std/io.slo`
- `std/process.slo`
- `std/vec_i32.slo`
- `std/vec_f64.slo`
- `std/vec_bool.slo`
- `std/vec_i64.slo`
- `std/vec_string.slo`
- `std/string.slo`
- `std/num.slo`
- `std/result.slo`
- `std/option.slo`
- `std/math.slo`
- `std/time.slo`
- `std/random.slo`
- `std/env.slo`
- `std/fs.slo`
- `std/net.slo`
- `std/json.slo`
This follows a Zig-like standard-library facade discipline in a Slovo-sized
form: flat `std/*.slo` facade files are the staged source surface now, and a
future `std.slo` aggregator/reexport layer remains deferred until broader
import/search semantics exist.
`math.slo` contains narrow source-authored helpers expressible in current
Slovo. exp-39 includes `abs`, `neg`, `min`, `max`, `clamp`, `square`, `cube`,
zero/positive/negative predicates, and inclusive `in_range` helpers for
`i32`, `i64`, and finite `f64` where the current language can express those
helpers directly. exp-56 adds `rem_i32`, `is_even_i32`, `is_odd_i32`,
`rem_i64`, `is_even_i64`, and `is_odd_i64` over the promoted integer
remainder operator. exp-57 adds `bit_and_i32`, `bit_or_i32`, `bit_xor_i32`,
`bit_and_i64`, `bit_or_i64`, and `bit_xor_i64` over the promoted integer
bitwise heads. The other modules provide small wrapper functions over
already promoted compiler-known standard-runtime calls where the current
language can express a wrapper cleanly.
`std/string.slo` includes the exp-34 `parse_bool_result` wrapper over
`std.string.parse_bool_result`. exp-60 adds `parse_i32_or_zero`,
`parse_i64_or_zero`, `parse_f64_or_zero`, and `parse_bool_or_false` as
ordinary source `match` helpers over the existing concrete parse result
families. exp-68 adds `parse_i32_or`, `parse_i64_or`, `parse_f64_or`, and
`parse_bool_or` as ordinary source custom-fallback helpers over those same
concrete parse result families. exp-110 adds `parse_i32_option`,
`parse_i64_option`, `parse_f64_option`, and `parse_bool_option` as ordinary
source option helpers over those same concrete parse result families through
the exp-109 `std.result.ok_or_none_*` bridge helpers. The current Slovo-side
exp-125 target adds matching `parse_u32_result`, `parse_u32_option`,
`parse_u32_or_zero`, `parse_u32_or`, `parse_u64_result`,
`parse_u64_option`, `parse_u64_or_zero`, and `parse_u64_or` lanes.
`1.0.0-beta.16` adds `byte_at_result`, `slice_result`, `starts_with`, and
`ends_with` as byte-oriented helpers over current runtime strings. Invalid
byte indexes and ranges return `err 1`; empty prefixes and suffixes match.
`1.0.0-beta.20` adds `contains`,
`index_of_option`, `last_index_of_option`, `trim_ascii_start`,
`trim_ascii_end`, and `trim_ascii` as ordinary source helpers over those same
byte primitives. Empty needles match at first index `0` and last index
`(len value)`. ASCII trim removes only bytes `9`, `10`, `11`, `12`, `13`, and
`32` from the requested edges.
This string scanning foundation does not add Unicode scalar or grapheme
semantics, full JSON parsing, tokenizer objects, language-level slice/view
syntax, mutable strings, stable ABI/layout promises, or a stable stdlib/API
freeze.
`std/num.slo` includes the exp-31 `f64_to_i64_result` wrapper over
`std.num.f64_to_i64_result`. exp-64 adds `i64_to_i32_or`, `f64_to_i32_or`,
and `f64_to_i64_or` as ordinary source `match` helpers over the existing
checked numeric conversion result families. The current Slovo-side exp-125
target adds `u32_to_string` and `u64_to_string`.
`std/result.slo` includes the exp-33 concrete `is_err_*` and `unwrap_err_*`
source helpers for the already promoted result families, plus
`unwrap_or_i32`, `unwrap_or_i64`, `unwrap_or_string`, and `unwrap_or_f64`.
exp-35 extends that source-authored concrete helper slice with
`is_ok_bool`, `is_err_bool`, `unwrap_ok_bool`, `unwrap_err_bool`, and
`unwrap_or_bool` for `(result bool i32)`, aligned with the exp-34 bool parse
result fixture flow. exp-74 adds concrete source constructors `ok_i32`,
`err_i32`, `ok_i64`, `err_i64`, `ok_string`, `err_string`, `ok_f64`,
`err_f64`, `ok_bool`, and `err_bool` so source can construct the current
promoted result families without repeating raw `ok` and `err` type heads.
exp-109 adds the concrete bridge helpers `ok_or_none_i32`, `ok_or_none_i64`,
`ok_or_none_string`, `ok_or_none_f64`, and `ok_or_none_bool`, returning the
matching `some` payload for `ok` results and the matching `none` value for
`err` results without importing `std.option`. The current Slovo-side exp-125
target adds the same concrete helper families for `(result u32 i32)` and
`(result u64 i32)`.
`std/option.slo` includes the exp-36 concrete `(option i32)` helpers
`is_some_i32`, `is_none_i32`, `unwrap_some_i32`, and `unwrap_or_i32`, written
as ordinary Slovo source over existing `is_some`, `is_none`, `unwrap_some`,
and `if`. exp-75 adds `some_i32` and `none_i32` as concrete source
constructors for that same `(option i32)` family. exp-95 broadens the staged
module to concrete `(option i64)` with `some_i64`, `none_i64`, `is_some_i64`,
`is_none_i64`, `unwrap_some_i64`, and `unwrap_or_i64`, still as ordinary
source functions over the already promoted option forms. exp-100 broadens the
same staged module again to concrete `(option string)` with `some_string`,
`none_string`, `is_some_string`, `is_none_string`, `unwrap_some_string`, and
`unwrap_or_string`, still as ordinary source functions over the already
promoted option forms. exp-102 broadens the same staged module again to
concrete `(option f64)` with `some_f64`, `none_f64`, `is_some_f64`,
`is_none_f64`, `unwrap_some_f64`, and `unwrap_or_f64`, plus concrete
`(option bool)` with `some_bool`, `none_bool`, `is_some_bool`,
`is_none_bool`, `unwrap_some_bool`, and `unwrap_or_bool`, still as ordinary
source functions over the already promoted option forms. exp-109 adds the
concrete bridge helpers `some_or_err_i32`, `some_or_err_i64`,
`some_or_err_f64`, `some_or_err_bool`, and `some_or_err_string`, returning
`ok` with the matching payload for `some` values and `err err_code` for
`none` values without importing `std.result`. The current Slovo-side exp-125
target adds the same concrete constructor/observer/unwrap/fallback/bridge
shape for `(option u32)` and `(option u64)`.
`std/time.slo` includes the exp-37 narrow source wrappers `monotonic_ms`
over `std.time.monotonic_ms` and `sleep_ms_zero` over `std.time.sleep_ms`,
calling `std.time.sleep_ms 0` and returning `0` because user-defined
unit-return functions are not generally supported.
`std/random.slo`, `std/env.slo`, and `std/fs.slo` include the exp-38 narrow
source wrappers over already released random, environment, and text filesystem
host/runtime calls. exp-62 adds `has` and `get_or` to `std/env.slo` as
ordinary source `match` helpers over the existing `(result string i32)`
environment lookup family. exp-65 extends `std/env.slo` with `get_i32_result`,
`get_i32_or_zero`, `get_i64_result`, `get_i64_or_zero`, `get_f64_result`,
`get_f64_or_zero`, `get_bool_result`, and `get_bool_or_false` as ordinary
source helpers over `get_result` plus the existing concrete parse result
families from `std.string`. exp-69 extends `std/env.slo` with `get_i32_or`,
`get_i64_or`, `get_f64_or`, and `get_bool_or` as ordinary source
custom-fallback helpers over `get_result` plus those same concrete parse
result families from `std.string`. exp-110 adds `get_option`,
`get_i32_option`, `get_i64_option`, `get_f64_option`, and `get_bool_option`
as ordinary source option helpers over the existing environment lookup and
typed parse result families through the exp-109 `std.result.ok_or_none_*`
bridge helpers. exp-63 adds `read_text_or` and
`write_text_ok` to `std/fs.slo` as ordinary source `match` helpers over the
existing `(result string i32)` and `(result i32 i32)` text filesystem
families.
exp-66 extends `std/fs.slo` with `read_i32_result`, `read_i32_or_zero`,
`read_i64_result`, `read_i64_or_zero`, `read_f64_result`, `read_f64_or_zero`,
`read_bool_result`, and `read_bool_or_false` as ordinary source helpers over
`read_text_result` plus the existing concrete parse result families from
`std.string`. exp-70 extends `std/fs.slo` with `read_i32_or`, `read_i64_or`,
`read_f64_or`, and `read_bool_or` as ordinary source custom-fallback helpers
over `read_text_result` plus those same concrete parse result families from
`std.string`. exp-110 adds `read_text_option`, `read_i32_option`,
`read_i64_option`, `read_f64_option`, and `read_bool_option` as ordinary
source option helpers over those same read/parse result families through the
exp-109 `std.result.ok_or_none_*` bridge helpers.
`std/net.slo` is the beta.6 networking foundation source facade. It wraps
blocking loopback TCP connect/listen/bound-port/accept/read-all/write-text/
close result calls and adds only `tcp_write_text_ok` and `tcp_close_ok` source
helpers. It is not a general networking module: DNS, TLS, async IO, UDP,
non-loopback binding, socket options, rich host errors, and stable handle ABI
remain deferred.
`std/json.slo` is the beta.7 serialization/data-interchange source facade. It
wraps `std.json.quote_string` and composes compact JSON scalar, field, small
array, and small object text from existing string and number helpers.
`1.0.0-beta.17` adds primitive scalar token parse facades for `bool`, `i32`,
`u32`, `i64`, `u64`, `f64`, and exact `null` only. The
`1.0.0-beta.18` source facade adds `parse_string_value_result` for one exact
ASCII JSON string token with simple escape decoding. The
`1.0.0-beta.21` source facade adds `parse_string_document_result`,
`parse_bool_document_result`, `parse_i32_document_result`,
`parse_u32_document_result`, `parse_i64_document_result`,
`parse_u64_document_result`, `parse_f64_document_result`, and
`parse_null_document_result`; each trims ASCII whitespace around the whole
document with `std.string.trim_ascii`, then delegates to the matching exact
value-token parser. It is not a full JSON parser and does not define
object/array parsing, recursive JSON values, maps/sets, streaming decoders or
encoders, schema validation, Unicode escape decoding/normalization beyond the
existing string-token behavior, embedded NUL policy, or stable text encoding
policy beyond the current runtime string ABI.
`std/process.slo` includes the exp-52 narrow source wrappers over already
released process argument runtime calls and a source-authored `has_arg`
predicate. exp-61 adds `arg_or` and `arg_or_empty` as ordinary source
fallback helpers over the existing `(result string i32)` process argument
family. exp-67 extends `std/process.slo` with `arg_i32_result`,
`arg_i32_or_zero`, `arg_i64_result`, `arg_i64_or_zero`, `arg_f64_result`,
`arg_f64_or_zero`, `arg_bool_result`, and `arg_bool_or_false` as ordinary
source helpers over `arg_result` plus the existing concrete parse result
families from `std.string`. exp-71 extends `std/process.slo` with `arg_i32_or`,
`arg_i64_or`, `arg_f64_or`, and `arg_bool_or` as ordinary source
custom-fallback helpers over `arg_result` plus those same concrete parse
result families from `std.string`. exp-110 adds `arg_option`,
`arg_i32_option`, `arg_i64_option`, `arg_f64_option`, and `arg_bool_option`
as ordinary source option helpers over those same argument/parse result
families through the exp-109 `std.result.ok_or_none_*` bridge helpers.
`std/io.slo` includes the exp-49 zero-returning print wrappers over the
promoted print runtime calls. exp-73 adds `print_i32_value`,
`print_i64_value`, `print_f64_value`, `print_string_value`, and
`print_bool_value` as ordinary source wrappers that preserve the printed
value for expression flow without adding new compiler-known runtime names.
exp-111 adds a connected stdin helper package over
`std.io.read_stdin_result`, `std.string.parse_*_result`, and the exp-109
`std.result.ok_or_none_*` bridge helpers:
`read_stdin_result`, `read_stdin_option`, `read_stdin_or`,
`read_stdin_i32_result`, `read_stdin_i32_option`, `read_stdin_i32_or_zero`,
`read_stdin_i32_or`, `read_stdin_i64_result`, `read_stdin_i64_option`,
`read_stdin_i64_or_zero`, `read_stdin_i64_or`, `read_stdin_f64_result`,
`read_stdin_f64_option`, `read_stdin_f64_or_zero`, `read_stdin_f64_or`,
`read_stdin_bool_result`, `read_stdin_bool_option`,
`read_stdin_bool_or_false`, and `read_stdin_bool_or`.
`std/cli.slo` includes the exp-53 source-authored argument text and `i32`
parse facade helpers over `std.process` and `std.string`. exp-54 adds
`i64` result/fallback helpers. exp-55 adds result-based `f64` and `bool`
helpers plus `arg_f64_or_zero` and `arg_bool_or_false`. exp-72 adds
`arg_i32_or`, `arg_i64_or`, `arg_f64_or`, and `arg_bool_or` as ordinary
source custom-fallback helpers over those same CLI result helpers. exp-110
adds `arg_text_option`, `arg_i32_option`, `arg_i64_option`, `arg_f64_option`,
and `arg_bool_option` as ordinary source option helpers over those same CLI
result helpers through the exp-109 `std.result.ok_or_none_*` bridge helpers.
The staged CLI facade now directly imports `std.result` alongside
`std.process` and `std.string`. exp-78 later records the earlier, narrower
local-source contract for the sibling Glagol gate without widening that
release's helper list or adding new compiler-known runtime names.
`std/vec_i32.slo` includes the exp-76 concrete `(vec i32)` collection facade
over the already promoted `std.vec.i32` runtime family. It adds direct
wrappers `empty`, `append`, `len`, and `at`, builder helpers `singleton`,
`append2`, `append3`, `pair`, and `triple`, query helpers `is_empty`,
`index_or`, `first_or`, and `last_or`, exp-77 option-query helpers
`index_option`, `first_option`, `last_option`, `index_of_option`, and
`last_index_of_option`, plus simple real-program helpers `contains` and
`sum` written as ordinary source `while` loops over the existing vector
runtime operations. exp-79 adds transform helpers `concat`, `take`, `drop`,
and `reverse` as ordinary recursive source helpers over `append`, `len`,
`at`, and `empty`. `take` treats negative counts as zero and returns the
original vector when the requested count reaches or exceeds the current
length; `drop` treats negative counts as zero and returns an empty vector
when the requested count reaches or exceeds the current length. exp-80 adds
generated constructor helpers `repeat` and `range_from_zero` as ordinary
recursive source helpers over `append` and `empty`. `repeat` returns an
empty vector when `count <= 0`. `range_from_zero` produces `0`, `1`, and so
on up to but excluding `count`, and returns an empty vector when
`count <= 0`. exp-81 adds public
`range ((start i32) (end_exclusive i32)) -> (vec i32)` with ascending
half-open semantics, allows negative bounds, returns an empty vector when
`end_exclusive <= start`, and may let `range_from_zero` delegate to
`range 0 count`. exp-82 adds public
`replace_at ((values (vec i32)) (position i32) (replacement i32)) ->
(vec i32)` as an ordinary compositional source helper over `append`, `take`,
`drop`, and `concat`; it returns a same-length replacement result for
in-range positions and returns `values` unchanged for negative or
out-of-range positions without mutating the source vector. exp-83 adds public
`remove_at ((values (vec i32)) (position i32)) -> (vec i32)` as an ordinary
compositional source helper over `take`, `drop`, and `concat`; it removes the
in-range `position` element, preserves the order of the remaining values,
returns a `len(values) - 1` result in that case, and returns `values`
unchanged for negative or out-of-range positions without mutating the source
vector. exp-84 adds public
`insert_at ((values (vec i32)) (position i32) (value i32)) -> (vec i32)` as
an ordinary compositional source helper over `append`, `take`, `drop`, and
`concat`; it inserts `value` before the current element at an in-range
`position`, appends when `position == len(values)`, returns a
`len(values) + 1` result for those valid insertions, and returns `values`
unchanged for negative or greater-than-length positions without mutating the
source vector. exp-85 adds public
`subvec ((values (vec i32)) (start i32) (end_exclusive i32)) -> (vec i32)`
as an ordinary compositional source helper over `take` and `drop`; it
returns a copied contiguous subvector `[start, end_exclusive)`, returns
`(empty)` when `start < 0`, `end_exclusive <= start`, or
`start >= len(values)`, returns the remaining tail from `start` when
`end_exclusive > len(values)`, preserves source order, and leaves the source
vector unchanged without introducing slice/view semantics. exp-86 adds public
`remove_range ((values (vec i32)) (start i32) (end_exclusive i32)) ->
(vec i32)` as an ordinary compositional source helper over `take`, `drop`,
and `concat`; it removes the half-open range `[start, end_exclusive)` from
`values`, returns `values` unchanged when `start < 0`,
`end_exclusive <= start`, or `start >= len(values)`, removes the tail from
`start` when `end_exclusive >= len(values)`, preserves the order of the
remaining elements, and leaves the source vector unchanged. exp-87 adds
public `insert_range ((values (vec i32)) (position i32)
(inserted (vec i32))) -> (vec i32)` as an ordinary compositional source
helper over `take`, `drop`, and `concat`; it inserts all of `inserted`
before the current element at `position` when `0 <= position < len(values)`,
appends `inserted` at the end when `position == len(values)`, returns
`values` unchanged when `position < 0` or `position > len(values)`,
preserves the order of both vectors, leaves both source vectors unchanged,
and returns a `len(values) + len(inserted)` result for valid positions.
exp-88 adds public
`replace_range ((values (vec i32)) (start i32) (end_exclusive i32)
(replacement (vec i32))) -> (vec i32)` as an ordinary compositional source
helper over `take`, `drop`, and `concat`; it replaces the half-open range
`[start, end_exclusive)` with all of `replacement`, returns `values`
unchanged when `start < 0`, `end_exclusive <= start`, or
`start >= len(values)`, replaces the tail from `start` when
`end_exclusive >= len(values)`, preserves the order of the prefix,
replacement, and surviving suffix, and leaves both source vectors
unchanged. exp-89 adds public
`starts_with ((values (vec i32)) (prefix (vec i32))) -> bool` as an ordinary
compositional source helper over `take`, `len`, and vec equality; it returns
`true` when `values` begins with all elements of `prefix` in order, returns
`true` for an empty prefix, returns `false` when `len(prefix) > len(values)`,
and leaves both source vectors unchanged. exp-90 adds public
`ends_with ((values (vec i32)) (suffix (vec i32))) -> bool` as an ordinary
compositional source helper over `drop`, `len`, and vec equality; it returns
`true` when `values` ends with all elements of `suffix` in order, returns
`true` for an empty suffix, returns `false` when `len(suffix) > len(values)`,
and leaves both source vectors unchanged. exp-91 adds public
`without_suffix ((values (vec i32)) (suffix (vec i32))) -> (vec i32)` as an
ordinary compositional source helper over `ends_with`, `take`, and `len`; it
returns `values` with a matching trailing suffix removed, returns `values`
unchanged for empty, longer, or mismatched suffixes, returns `(empty)` for an
exact match, and leaves both source vectors unchanged. exp-92 adds public
`without_prefix ((values (vec i32)) (prefix (vec i32))) -> (vec i32)` as an
ordinary compositional source helper over `starts_with`, `drop`, and `len`;
it returns `values` with a matching leading prefix removed, returns `values`
unchanged for empty, longer, or mismatched prefixes, returns `(empty)` for an
exact match, and leaves both source vectors unchanged. exp-93 adds public
`count_of ((values (vec i32)) (target i32)) -> i32` as an ordinary source
helper over `len`, `at`, equality, and `while`; it returns the number of
elements equal to `target`, returns `0` for empty or absent matches, counts
repeated matches exactly, and leaves the source vector unchanged. The
option-returning helpers stay concrete to `(option i32)` and construct
results through `std.option.some_i32` and `std.option.none_i32`. The module
stays concrete to `(vec i32)` and does not claim generic vectors, slice
types, capacity management, mutation-heavy container APIs, sorting, mapping,
filtering, or broader collection families.
`std/vec_i64.slo` includes the exp-94 concrete `(vec i64)` baseline facade
over the sibling `std.vec.i64` runtime family. It adds direct wrappers
`empty`, `append`, `len`, and `at`, builder helpers `singleton`, `append2`,
`append3`, `pair`, and `triple`, query helpers `is_empty`, `index_or`,
`first_or`, and `last_or`, plus simple real-program helpers `contains` and
`sum` written as ordinary source control-flow helpers over the direct runtime
wrappers. exp-96 extends that same facade with option-query helpers
`index_option`, `first_option`, `last_option`, `index_of_option`, and
`last_index_of_option`. Those helpers stay concrete to `(option i64)` and
`(option i32)`, construct raw current option values directly instead of
importing `std.option`, and keep the full `vec_i64` source family recursive
and immutable with no `var` or `set`. `index_or` returns its fallback for
negative and out-of-range positions; `first_or` delegates to `index_or values
0 fallback`; `last_or` returns its fallback for empty vectors and the final
element otherwise; `index_option` returns `(none i64)` for negative and
out-of-range positions; `first_option` delegates to `index_option values 0`;
`last_option` returns `(none i64)` for empty vectors and `(some i64 ...)`
otherwise; `index_of_option` and `last_index_of_option` return `(none i32)`
when the target is absent; `contains` returns `true` exactly when any element
equals the target; and `sum` returns `0i64` for empty vectors. exp-97 adds
transform helpers `concat`, `take`, `drop`, and `reverse` plus the copied
half-open range helper `subvec` as ordinary recursive source helpers over
`append`, `len`, `at`, and `empty`. `take` treats negative counts as zero and
saturates to the full vector. `drop` treats negative counts as zero and
saturates to the empty vector. `subvec` returns `(empty)` for negative or
empty ranges and saturates `end_exclusive` to the source tail. exp-98 adds
edit helpers `insert_at`, `insert_range`, `replace_at`, `replace_range`,
`remove_at`, and `remove_range` as ordinary compositional source helpers over
the already released vec_i64 helper surface, especially `concat`, `take`, and
`drop`. `insert_at` and `insert_range` append at exact tail positions and
otherwise return `values` unchanged for negative or greater-than-length
positions. `replace_at` and `remove_at` return `values` unchanged for
negative or out-of-range positions. `replace_range` and `remove_range`
return `values` unchanged for negative, empty, or past-end starts and
saturate `end_exclusive` to the source tail. The module
stays concrete to `(vec i64)` and does not claim generic vectors, slice
types, capacity management, mutation-heavy container APIs, transform/range/edit
helper families beyond `concat`, `take`, `drop`, `reverse`, `subvec`,
`insert_at`, `insert_range`, `replace_at`, `replace_range`, `remove_at`, and
`remove_range`,
sorting, mapping, filtering, or broader collection families.
`std/vec_f64.slo` includes the exp-103 concrete `(vec f64)` baseline facade
over the sibling `std.vec.f64` runtime family. exp-105 broadens the same
module with the transform helpers `concat`, `take`, `drop`, `reverse`, and
`subvec` written as ordinary recursive source helpers over the direct runtime
wrappers. exp-106 further broadens the same module with the option-query
helpers `index_option`, `first_option`, `last_option`, `index_of_option`,
and `last_index_of_option`, still written as ordinary recursive immutable
source helpers over the same direct runtime wrappers plus the current
concrete `(option f64)` and `(option i32)` forms where needed. The module
gains exp-107 immutable edit helpers `insert_at`, `insert_range`,
`replace_at`, `replace_range`, `remove_at`, and `remove_range`, still using
only existing helper composition and the same direct runtime wrappers.
exp-108 further broadens the same module with `starts_with`,
`without_prefix`, `ends_with`, and `without_suffix`, still using only
existing helper composition and the same direct runtime wrappers. The module
stays concrete to `(vec f64)` and does not claim generic vectors, capacity
management, mutation-heavy container APIs, sorting, mapping, filtering, or
broader collection families.
`std/vec_bool.slo` is the released exp-104 Slovo-side contract for a
concrete `(vec bool)` baseline facade over the sibling `std.vec.bool` runtime
family. exp-105 broadens the same module with the transform helpers
`concat`, `take`, `drop`, `reverse`, and `subvec`, all written as ordinary
deterministic recursive source helpers over the direct runtime wrappers and
bool equality. exp-106 further broadens the same module with the option-query
helpers `index_option`, `first_option`, `last_option`, `index_of_option`,
and `last_index_of_option`, still written as ordinary recursive immutable
source helpers over the same direct runtime wrappers plus the current
concrete `(option bool)` and `(option i32)` forms where needed. exp-107
further broadens the same module with immutable edit helpers `insert_at`,
`insert_range`, `replace_at`, `replace_range`, `remove_at`, and
`remove_range`, still written as ordinary helper composition over the same
direct runtime wrappers. exp-108 further broadens the same module with
`starts_with`, `without_prefix`, `ends_with`, and `without_suffix`, again
written as ordinary helper composition over the same direct runtime
wrappers. This file is present in the released Slovo source tree, and
explicit external `std.vec_bool` resolution now depends on the paired
Glagol exp-108 gate set.
`std/vec_string.slo` includes the exp-99 concrete `(vec string)` baseline
facade over the sibling `std.vec.string` runtime family. It adds direct
wrappers `empty`, `append`, `len`, and `at`, builder helpers `singleton`,
`append2`, `append3`, `pair`, and `triple`, query helpers `is_empty`,
`index_or`, `first_or`, and `last_or`, plus simple real-program helpers
`contains` and `count_of` written as ordinary recursive source helpers over
the direct runtime wrappers and string equality. exp-101 broadens the same
module with the option-query helpers `index_option`, `first_option`,
`last_option`, `index_of_option`, and `last_index_of_option`, plus the
transform helpers `concat`, `take`, `drop`, `reverse`, and `subvec`, all
still written as ordinary recursive immutable source helpers over the same
direct runtime wrappers plus raw current `(option string)` / `(option i32)`
forms where needed. `index_or` returns its fallback for negative and
out-of-range positions; `first_or` delegates to `index_or values 0 fallback`;
`last_or` provides a stable empty-vector fallback; `contains` returns `true`
exactly when any element equals the target; `count_of` returns `0` for empty
vectors or absent targets while counting repeated matches exactly; and the
new transform helpers preserve the current immutable-vector contract. The
module gains exp-107 immutable edit helpers `insert_at`, `insert_range`,
`replace_at`, `replace_range`, `remove_at`, and `remove_range`, still
written as ordinary helper composition over the same direct runtime wrappers
and current concrete option forms where needed. exp-108 further broadens
the same module with `starts_with`, `without_prefix`, `ends_with`, and
`without_suffix`, still written as ordinary helper composition over the same
direct runtime wrappers and current concrete option forms where needed. The
module stays concrete to `(vec string)` and does not claim generics, nested
vecs or vecs inside other containers, mutating/capacity APIs, or broader
collection families.
The string fallback helper uses the existing `(result string i32)` `match`
shape instead of a string-valued `if`.
Deferred from exp-30, exp-32, exp-33, exp-34, exp-35, exp-36, exp-37, exp-38,
exp-39, exp-44, exp-45, exp-46, exp-47, exp-48, exp-49, exp-50, exp-51,
exp-52, exp-53, exp-54, exp-55, exp-56, exp-57, exp-60, exp-61, exp-62,
exp-63, exp-64, exp-65, exp-66, exp-67, exp-68, exp-69, exp-70, exp-71,
exp-72, exp-73, exp-74, exp-75, exp-76, exp-77, exp-78, exp-79, exp-80,
exp-81, exp-82, exp-83, exp-84, exp-85, exp-86, exp-87, exp-88, exp-89,
exp-90, exp-91, exp-92, exp-93, exp-94, exp-95, exp-96, exp-97, exp-98,
and exp-99:
automatic `std` imports, workspace dependency syntax for std, installed
toolchain stdlib paths beyond the exp-50 alpha discovery candidate, a
`std.slo` aggregator, package registry behavior, lockfiles, semantic version
solving, replacing compiler-known
`std.*` calls with source implementations, stable APIs, stable ABI/layout,
package registry behavior, generics, traits, overloads, generic result
helpers, generic option helpers, option payload families beyond `(option i32)`,
`(option i64)`, and `(option string)`,
`std.result.map`, generic
`std.result.unwrap_or`, `std.result.and_then`, broad math, trigonometry,
`sqrt`, `pow`, floating-point remainder, shifts, bit-not, mixed numeric arithmetic, generic
parse, string/bytes parse,
bool parsing beyond exact lowercase `true`/`false`, rich parse errors, broad
result payload families beyond promoted concrete fixture flows,
wall-clock/calendar/timezone APIs,
high-resolution timers, async timers, cancellation, scheduling guarantees,
random seeds, ranges, bytes, floats, UUIDs, crypto/security promises, stable
random sequences, environment mutation/enumeration, environment writes, rich
host error ADTs, typed file writes,
process spawning, exit/status control, current-directory APIs, signal
handling, shell parsing, option/flag parsing, subcommands, environment-backed
configuration, stable CLI framework APIs, binary file APIs, directory
traversal, streaming file IO, async file IO,
generic collections, vector payload families beyond `(vec i32)`,
`(vec i64)`, `(vec f64)`, and `(vec string)`, option payload families beyond
`(option i32)`, `(option i64)`, `(option f64)`, `(option bool)`, and
`(option string)`,
slice types, push/pop, capacity/reserve/shrink, descending or stepped ranges,
inclusive ranges, broader prefix/suffix helpers beyond `starts_with`,
`without_prefix`, `ends_with`, and `without_suffix`, subvector/range-removal/edit helpers
beyond `insert_range`, `replace_range`, `remove_range`, `subvec`,
`insert_at`, `replace_at`, `remove_at`, `without_prefix`, and `without_suffix`,
transform/range/edit helpers for `(vec i64)` beyond `concat`, `take`, `drop`,
`reverse`, `subvec`, `insert_at`, `insert_range`, `replace_at`,
`replace_range`, `remove_at`, and `remove_range`, sorting, mapping, filtering,
iterators, optimizer guarantees, benchmark thresholds, cross-machine
performance claims, and beta maturity.