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:
parent
77026fa9ec
commit
b38a7dd007
5 changed files with 226 additions and 2 deletions
|
|
@ -287,3 +287,9 @@
|
|||
;; for the `.` / `.-field` desugar. Loads after host-static.ss so it wraps every
|
||||
;; record-method-dispatch arm (jhost/number/regex/jrec/string) and falls through.
|
||||
(load "host/chez/dot-forms.ss")
|
||||
|
||||
;; java.io.File + host file I/O (jolt-yyud): path-backed jfile record, slurp/spit/
|
||||
;; flush, file-seq dir primitives, clojure.java.io/file. Loads LAST so its jfile
|
||||
;; arm wraps the fully-built record-method-dispatch and the str/type/instance-check
|
||||
;; extensions sit over every prior shim.
|
||||
(load "host/chez/io.ss")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue