Chez Phase 2 (inc V): java.io.File + slurp/spit/flush/file-seq (jolt-yyud)

A File is a path-backed jfile record: (instance? java.io.File f) is true,
str/slurp coerce it to its path, and the File method surface (getName/
getPath/exists/isDirectory/isFile/listFiles/getParent) dispatches through
record-method-dispatch. slurp/spit/flush run over Chez's filesystem
primitives; file-seq's dir primitives (__file?/__dir?/__list-dir) and the
overlay's File branch (.isDirectory/.listFiles, which emit to jolt-host-call)
are jfile-aware. clojure.java.io/file + as-file are def-var!'d natively.

New host/chez/io.ss, a Chez-native implementation -- the seed's
clojure.java.io (io.clj) is a Janet-backed shim over janet.*/janet.file, so
it can't be reused. The analyzer resolves io/file because the seed ctx has
clojure.java.io loaded; only a runtime def-var! is needed. type/instance-
check/str-render/jolt-host-call are extended via the set!-wrap pattern (type
also re-def-var!'d since the var cell captured the old value).

Reader/StringReader-coupled io (io/reader, line-seq over a file, .toURL,
slurp over a reader) deferred to jolt-at0a.

Parity 2176 -> 2191, 0 new divergences. New test/chez/_io.janet 20/20.
This commit is contained in:
Yogthos 2026-06-19 10:02:12 -04:00
parent 77026fa9ec
commit b38a7dd007
5 changed files with 226 additions and 2 deletions

View file

@ -253,8 +253,12 @@
# map-entry is now vector? matching Clojure's MapEntry; clojure.walk + clojure.
# template added to the prelude stdlib tier, the driver evals each ns's requires
# to register aliases at emit time) 2176.
# jolt-yyud (java.io.File as a path-backed jfile record + the File method surface,
# slurp/spit/flush over Chez file I/O, file-seq dir primitives, clojure.java.io/
# file — host/chez/io.ss, a Chez-native impl since io.clj is a janet.* shim;
# reader/StringReader-coupled io deferred to jolt-at0a) 2191.
# Strided runs scale down.
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2176")))
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2191")))
(def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor))
(when (or (> (length diverged) 0) (< pass floor))
(printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged)))