Scrub dangling Janet references; drop dead Janet-coupled files
Rephrase comments that pointed at deleted Janet files (emit.janet, the seed
sources, 'the Janet back end punts ...') to present-tense descriptions of the
Chez behavior. Comment/docstring-only; the self-host fixpoint is unchanged
(comments don't affect the compiled seed).
Delete five files that were Janet-host shims with no Chez path: clojure.java.io
(provided natively by host/chez/io.ss), and jolt.{nrepl,png,interop,shell}
(the janet.* bridge, os/shell, janet.net — none exist on Chez).
jolt-cf1q.6
This commit is contained in:
parent
750ce05716
commit
48e2ef5910
53 changed files with 418 additions and 675 deletions
|
|
@ -1,4 +1,4 @@
|
|||
;; clojure.core — kernel tier (stage just above the Janet seed).
|
||||
;; clojure.core — kernel tier (stage just above the host primitives).
|
||||
;;
|
||||
;; These are the structural fns the self-hosted compiler itself uses
|
||||
;; (jolt.analyzer): second/peek/subvec/mapv/update. Because the compiler must be
|
||||
|
|
@ -6,12 +6,11 @@
|
|||
;; before it is built. So this tier is loaded FIRST and, in compile mode, is
|
||||
;; bootstrap-compiled directly into clojure.core (not routed through the
|
||||
;; self-hosted pipeline, which would need these to already exist — the
|
||||
;; circularity that previously forced `second` to stay in Janet). With this tier
|
||||
;; in place the analyzer is built against the Clojure definitions and the Janet
|
||||
;; primitives are gone.
|
||||
;; circularity that previously forced `second` to stay a host primitive). With this tier
|
||||
;; in place the analyzer is built against the Clojure definitions.
|
||||
;;
|
||||
;; Constraint: depend only on core-renames primitives (first/next/nth/count/conj/
|
||||
;; vec/map/apply/assoc/get/…, all hardwired to the Janet seed) and on each other.
|
||||
;; vec/map/apply/assoc/get/…, all hardwired to host primitives) and on each other.
|
||||
|
||||
(defn second [coll] (first (next coll)))
|
||||
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@
|
|||
(defmacro declare [& syms]
|
||||
`(do ~@(map (fn* [s] `(def ~s)) syms)))
|
||||
|
||||
;; destructure — Clojure's binding-vector expander, ported from the Janet seed
|
||||
;; (was core-destructure). Turns a binding vector that may contain destructuring
|
||||
;; destructure — Clojure's binding-vector expander.
|
||||
;; Turns a binding vector that may contain destructuring
|
||||
;; patterns into a plain binding vector (alternating symbol / init-form) built from
|
||||
;; nth/nthnext/get, so the COMPILER only ever sees plain symbols (analyze-bindings
|
||||
;; rejects patterns). `let` consumes it directly; `loop`/`fn` reuse it transitively
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
;; clojure.core — seq tier. Pure-Clojure leaf sequence fns on top of the kernel
|
||||
;; tier (00-kernel) and the Janet seed. Loaded after the kernel tier; in compile
|
||||
;; tier (00-kernel) and the host primitives. Loaded after the kernel tier; in compile
|
||||
;; mode these self-host through the now-built analyzer (interpreted otherwise).
|
||||
;;
|
||||
;; Migration rule for adding fns here: the fn must (1) NOT be in
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
;; neg? throws on non-numbers via <, as Clojure's Numbers.isNeg does.
|
||||
(defn neg? [x] (< x 0))
|
||||
|
||||
;; even?/odd? stay in the seed: (filter even? ...) is idiomatic-hot and the
|
||||
;; even?/odd? stay host primitives: (filter even? ...) is idiomatic-hot and the
|
||||
;; overlay versions cost an extra call layer per element (seq-pipe bench 4x).
|
||||
|
||||
;; Variadic bit ops — canonical Clojure arities folding the binary host op
|
||||
|
|
@ -355,9 +355,9 @@
|
|||
(make-hierarchy) (partition 2 deriv-seq))
|
||||
h))))
|
||||
|
||||
;; --- Stage 3 tier shrink: pure-over-core leaves moved off the Janet seed ----
|
||||
;; --- Stage 3 tier shrink: pure-over-core leaves moved off the host primitives ----
|
||||
|
||||
;; Representation predicates over the overlay's own predicates (no Janet reps).
|
||||
;; Representation predicates over the overlay's own predicates.
|
||||
(defn sequential? [x] (or (vector? x) (seq? x)))
|
||||
(defn associative? [x] (or (map? x) (vector? x)))
|
||||
(defn counted? [x]
|
||||
|
|
@ -381,10 +381,10 @@
|
|||
|
||||
|
||||
;; realized?: defined on the pending types only (delay/lazy-seq/future read
|
||||
;; Tagged-value predicates. The constructors (atom/volatile!/...) stay in Janet,
|
||||
;; but every tagged value carries its kind under :jolt/type (records under
|
||||
;; :jolt/deftype), reachable via get — which is nil on non-tables — so the
|
||||
;; predicates are pure over get and move out of the seed.
|
||||
;; Tagged-value predicates. The constructors (atom/volatile!/...) are host
|
||||
;; primitives, but every tagged value carries its kind under :jolt/type (records
|
||||
;; under :jolt/deftype), reachable via get — which is nil on non-tables — so the
|
||||
;; predicates are pure over get.
|
||||
(defn atom? [x] (= (get x :jolt/type) :jolt/atom))
|
||||
(defn volatile? [x] (= (get x :jolt/type) :jolt/volatile))
|
||||
(defn reader-conditional? [x] (= (get x :jolt/type) :jolt/reader-conditional))
|
||||
|
|
@ -418,7 +418,7 @@
|
|||
:else (throw (str "pop not supported on: " coll))))
|
||||
|
||||
;; doall/dorun: realization boundaries. dorun walks (optionally at most n
|
||||
;; steps — the Janet seed version ignored n); doall walks then returns coll.
|
||||
;; steps); doall walks then returns coll.
|
||||
(defn dorun
|
||||
([coll]
|
||||
(loop [s (seq coll)]
|
||||
|
|
@ -791,7 +791,7 @@
|
|||
(defn numerator [x] (throw (ex-info "numerator requires a ratio (Jolt has no ratios)" {})))
|
||||
(defn denominator [x] (throw (ex-info "denominator requires a ratio (Jolt has no ratios)" {})))
|
||||
|
||||
;; No class hierarchy on the Janet host.
|
||||
;; No class hierarchy on this host.
|
||||
(defn supers [x] #{})
|
||||
|
||||
;; Like Clojure's munge: rewrite dashes to underscores, preserving the argument's
|
||||
|
|
@ -949,7 +949,7 @@
|
|||
;; inst-ms itself.
|
||||
(defn inst-ms* [i] (inst-ms i))
|
||||
|
||||
;; Canonical comp — here rather than the seed so each stage is invoked with
|
||||
;; Canonical comp — here rather than a host primitive so each stage is invoked with
|
||||
;; jolt call semantics: (comp seq :content) works because the keyword stage
|
||||
;; goes through IFn dispatch (raw Janet keyword application does not).
|
||||
(defn comp
|
||||
|
|
@ -1078,7 +1078,7 @@
|
|||
(let [xf (xform f)]
|
||||
(xf (reduce xf init coll)))))
|
||||
|
||||
;; into stays in the seed: it's perf-wall hot (the into-vec bench pays ~11%
|
||||
;; into stays a host primitive: it's perf-wall hot (the into-vec bench pays ~11%
|
||||
;; through the overlay call layers — same lesson as even?/odd? in round 4).
|
||||
|
||||
;; eduction is EAGER on jolt (documented divergence, as before): the composed
|
||||
|
|
@ -1116,8 +1116,8 @@
|
|||
|
||||
;; print-method / print-dup are real multimethods in the io tier (50-io.clj).
|
||||
|
||||
;; JVM proxies don't exist on a Janet host: the read-only surface is inert,
|
||||
;; the constructive surface throws (matching the prior seed stubs).
|
||||
;; JVM proxies don't exist on this host: the read-only surface is inert,
|
||||
;; the constructive surface throws.
|
||||
(defn proxy-mappings [p] {})
|
||||
(defn proxy-call-with-super [f p meth] (f))
|
||||
(defn init-proxy [p mappings] p)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
;; and the methods become functions — the algorithm is identical.
|
||||
;;
|
||||
;; A sorted-SET stores its elements as keys with a nil value; its ops project the
|
||||
;; key. ALL the semantics live here in Clojure; the Janet seed keeps only its
|
||||
;; key. ALL the semantics live here in Clojure; the host keeps only its
|
||||
;; dispatch branches (conj/assoc/get/seq/count/…), each a one-line call through
|
||||
;; the value's own :ops table, so the ops travel WITH the value (correct across
|
||||
;; contexts, forks, and AOT images). The wrapper is minted/read through the host
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
|
||||
(defn- ss-disj-many [ss xs] (reduce ss-disj-1 ss xs))
|
||||
|
||||
;; --- the ops tables the Janet seed dispatches through ------------------------
|
||||
;; --- the ops tables the host dispatches through ------------------------
|
||||
|
||||
(def ^:private sm-ops
|
||||
{:count (fn [sm] (sfield sm :cnt))
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
;; IMPORTANT — only macros NOT used by the self-hosted compiler (jolt-core/jolt/*)
|
||||
;; or by the earlier overlay tiers belong here; those (and/or/when/when-not/
|
||||
;; when-let/cond/case/doseq/declare/cond->/->) must stay available before this
|
||||
;; tier loads, so they remain in Janet for now. Everything here is user-facing.
|
||||
;; tier loads, so they remain host primitives for now. Everything here is user-facing.
|
||||
;;
|
||||
;; Migration: remove the Janet core-X macro fn AND its core-macro-names entry when
|
||||
;; Migration: remove the host core-X macro fn AND its core-macro-names entry when
|
||||
;; moving a macro here (defmacro installs the :macro flag itself).
|
||||
|
||||
(defmacro comment [& body] nil)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
()))
|
||||
|
||||
;; --- repeatedly --- ((f) throws on a non-fn; (take n …) throws on a non-number
|
||||
;; count — both now enforced in the seed (jolt-call / core-take), so the canonical
|
||||
;; count — both enforced by the host (jolt-call / take), so the canonical
|
||||
;; CLJ form matches the repeatedly.cljc exception cases.)
|
||||
(defn repeatedly
|
||||
([f] (lazy-seq (cons (f) (repeatedly f))))
|
||||
|
|
@ -105,8 +105,8 @@
|
|||
;; --- partition-all --- (transducer + [n coll] + [n step coll])
|
||||
;; The collection arities realize EXACTLY n per chunk via a first/rest loop and
|
||||
;; continue from the advanced cursor (not a re-drop / nthrest), so they realize
|
||||
;; minimally — matching the Janet pstep the §6.3 laziness counters were written
|
||||
;; against. (A take/nthrest form is correct but over-realizes.)
|
||||
;; minimally — the §6.3 laziness counters depend on this.
|
||||
;; (A take/nthrest form is correct but over-realizes.)
|
||||
(defn partition-all
|
||||
([n]
|
||||
(fn [rf]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue