Install the standard library from Tarver's StLib sources (SBCL/CLISP)#9
Merged
Conversation
Retires the community stlib.kl graft on the image-based hosts in favour of Mark Tarver's canonical StLib sources (mirror pyrex41/shen-upstream, tag s41.2-pristine-20260711, Lib/StLib). SBCL and CLISP now run his install.shen through the freshly built image at build time -- typechecking and loading each module, declaring the stlib externals as system functions -- and the saved image bakes it in, exactly as Tarver's own install.lsp does. - scripts/assemble-tarver-kernel.sh: copy Tarver's Lib/StLib to kernel/lib/StLib; keep community stlib.kl for ECL only (documented). - boot.lsp: #-ecl path loads kernel/lib/StLib/install.shen (cd/load/cd); the community stlib.lsp is imported under #+ecl only. - scripts/build.shen: keep precompiling stlib solely for ECL. - src/primitives.lsp: ECL init keeps stlib.initialise-* (graft) with a comment explaining why (see below). ECL keeps the graft: c:build-program links object files rather than dumping an image, so it cannot bake the runtime state from loading StLib sources; and loading them at ECL startup costs ~105s (ECL C-compiles each definition on load). Retiring ECL's graft needs a StLib->.lsp packager (fleet follow-up). This is the one stdlib divergence across implementations. Gate (macOS arm64): SBCL, CLISP and ECL all build and pass 134/134 with working stdlib (factorial/take/uppercase) and launcher (eval -l file -e expr). The ratatoskr stage-1 shake of tests/fib.shen is byte-identical (kernel.kl, 54 defuns) and deterministic; the launcher CLI ratatoskr depends on is preserved. No upstream StLib patches were needed. See docs/KERNEL-PROVENANCE-tarver-s41.2.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retires the community
stlib.klgraft on the image-based hosts in favour ofMark Tarver's canonical StLib sources (mirror
pyrex41/shen-upstream, tags41.2-pristine-20260711,Lib/StLib). SBCL and CLISP now run Tarver'sinstall.shenthrough the freshly built image at build time (typecheck + loadeach module, declare the stlib externals as system functions); the saved image
bakes it in — exactly as Tarver's own
install.lspdoes. Follows the mergedS41.2 refresh (#8).
What Tarver's
install.shendoes vs what we adoptedLib/StLib/install.shencds into the StLib dir and loads each module in aprecise order, toggling
(tc +/-)and(factorise +/-): Symbols → Maths(macros, maths, rationals/complex/numerals + their
.dtypedatatypes) → Lists→ Strings (+ smart) → Vectors macros → IO → Tuples; then
package-stlib.shen(defines the
stlibpackage as the union of module externals) and(map (fn systemf) …)to declare the externals as system functions, endingwith
(preclude-all-but [])and(cd "").Adopted verbatim:
boot.lsp'sshen-cl.initialise-stlibis now(cd "kernel/lib/StLib") (load "install.shen") (cd ""). Tarver's native orderalready loads the Maths datatypes before
Vectors/macros.shen, so the':='vector-macro-vs-typechecker hazard that forced a custom ordering under the
community stlib is avoided by construction (the old reorder comment is gone).
ECL keeps the graft (documented)
ECL builds via
c:build-program, which links object files rather than dumpingan image, so it cannot bake the runtime state from loading StLib sources;
and loading them at ECL startup costs ~105s (ECL C-compiles each definition
on load). So ECL alone keeps the precompiled community
stlib.kl, importedunder
#+eclinboot.lspand replayed cheaply at startup (~1.5s). This is theone stdlib divergence across implementations; retiring it needs a
StLib→
.lsppackager (fleet follow-up).Launcher preserved
The launcher CLI (
eval -l file -e expr) is untouched — it remains adeliberate, documented community-sourced extension (Tarver ships no
non-interactive CLI), and ratatoskr stage-1 depends on it.
Test status (macOS, arm64)
factorial/take/uppercase,eval -e/-q -l -efactorial/take/uppercase,eval -l file -e exprstlib.kl(graft)factorial/take,eval -e/-l -e; ~1.5s startupratatoskr stage-1 host: with this branch's SBCL binary as
$RATATOSKR_HOST,ratatoskr shake tests/fib.shengiveskernel.kl= 54 defuns / 13.4 KB,byte-identical to the pre-change host and deterministic across runs; the
user
<prog>.kldiffers only in gensym variable numbering (semanticallyidentical). Launcher CLI intact.
Reproducibility
scripts/assemble-tarver-kernel.sh(make fetch-tarver) copies Tarver'sLib/StLibtokernel/lib/StLiband keeps communitystlib.klfor ECL. Passthe
pyrex41/shen-upstreamcheckout as$1to build from the pinned tag.Upstream StLib observations
No patches needed — Tarver's
Lib/StLibsources load and typecheck cleanly onshen-cl (SBCL/CLISP) as-is. Nothing to report upstream from this pass.
🤖 Generated with Claude Code