Skip to content

prelude: effect protocols and Srs.* handlers, pure Str primitives (E2a) - #34

Merged
vic merged 1 commit into
mainfrom
e2a-prelude-effects
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
e2a-prelude-effects

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

E2a of the effects epic. This change only adds; no existing code changes behavior.

  • lib/prelude.srs adds one protocol per authority: Console (print, printI64, printChar, eprint, eprintI64), Args (count, at), Files (read) and Exit (exit). Each has one Srs.* handler that keeps no state (init gives rt_null()).
  • Str.len, Str.at, Str.slice and Str.eq are pure primitives. Their C bodies are in rt/srs_rt.c.
  • Purity and --eval find a string primitive through one typed lookup, Pure.prim (enum Pure.Prim). Before, each one compared names as strings.
  • The Args enum in lib/datalog.srs is renamed to ArgList, because all files share one namespace.

Tests: prog/eff_console, eval/str and neg/eff_spec.

Next (E2b + E3, one PR): error[rt-outside-srs] together with the migration of s2, s2c and the tests.

…ers (E2a); Str.len/at/slice/eq as pure primitives (one Pure.Prim lookup for purity and --eval); lib/datalog enum Args renamed ArgList
@vic
vic merged commit e8549d6 into main Nov 9, 2026
3 checks passed
@vic
vic deleted the e2a-prelude-effects branch November 17, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant