ludic/docs/language/builtins
Orkuncakilkaya 0d1b09e4f0
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 17s
ci / build-and-test (push) Successful in 1m14s
commit-lint / conventional-commits (push) Successful in 3s
docs / build-and-deploy (push) Successful in 19s
feat(errors): recoverable failures as values — try/else over ok/err results (#46)
A fallible function returns a `result` value, built with ok(payload) on success
or err(message) on failure. The caller recovers a value with `try EXPR else {
… }`: on ok the whole expression is the payload; on err the else block runs —
with the failure message bound to `error` — and its trailing expression supplies
the fallback. It is a plain branch on the result's tag: no exceptions, no hidden
control flow, nothing unwinds. is_ok(r) / is_err(r) classify without unwrapping.

Payloads are any i32-width scalar (int/fixed/bool/entity). The feature is
additive and only kicks in when ok/err/try are used, so untouched programs
compile byte-identically (verified) and the C-free bootstrap fixpoint holds.
Complements panic/assert from #8 (the unrecoverable half). The optional
top-level frame `recover` stays deferred (needs a frame-abort mechanism); the
full tagged-union/any generalization is tracked in #1.

Adds the `try` keyword and ok/err/is_ok/is_err builtins across the compiler,
the vocabulary header, JetBrains + TextMate/VSCode grammars, the docs inventory
and pages, examples/library/recover.ludic, and a regression case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-31 15:04:14 +03:00
..
_section.md docs: add Networking section + process/OS builtins (net_send, owner, is_server, serialize/apply, arg, exit, run, getenv, read_char, file_*) 2026-08-29 16:39:29 +03:00
fn-abs.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-arg.md refactor(lang): rename the str type (and stringify builtin) to string 2026-08-30 01:51:11 +03:00
fn-arg_count.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-assert.md feat(errors): panic(msg) + assert(cond, msg) with file:line — no raw crashes (#8) 2026-08-31 14:33:37 +03:00
fn-bytes.md refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
fn-clamp.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-err.md feat(errors): recoverable failures as values — try/else over ok/err results (#46) 2026-08-31 15:04:14 +03:00
fn-exit.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-file_stderr.md refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
fn-file_stdout.md refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
fn-file_write.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-fixed.md refactor(lang): rename builtins flr->floor and fx->fixed 2026-08-30 02:01:56 +03:00
fn-floor.md refactor(lang): rename builtins flr->floor and fx->fixed 2026-08-30 02:01:56 +03:00
fn-getenv.md refactor(lang): rename the str type (and stringify builtin) to string 2026-08-30 01:51:11 +03:00
fn-is_err.md feat(errors): recoverable failures as values — try/else over ok/err results (#46) 2026-08-31 15:04:14 +03:00
fn-is_ok.md feat(errors): recoverable failures as values — try/else over ok/err results (#46) 2026-08-31 15:04:14 +03:00
fn-len.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-load.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-max.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-min.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-ok.md feat(errors): recoverable failures as values — try/else over ok/err results (#46) 2026-08-31 15:04:14 +03:00
fn-panic.md feat(errors): recoverable failures as values — try/else over ok/err results (#46) 2026-08-31 15:04:14 +03:00
fn-print.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-push.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-quit.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-read_char.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-run.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-save.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-string.md refactor(lang): rename the str type (and stringify builtin) to string 2026-08-30 01:51:11 +03:00
fn-ui_build.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
fn-words.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00