Skip to content

Core interop round 4: read-eval, j.u.c construction, prefix lists, dotted protocol names - #701

Closed
yogthos wants to merge 7 commits into
fix/grain-core-round1from
fix/grain-core-round4
Closed

yogthos wants to merge 7 commits into
fix/grain-core-round1from
fix/grain-core-round4

Conversation

@yogthos

@yogthos yogthos commented Aug 22, 2026

Copy link
Copy Markdown
Member

Round 4 of the Grain-on-jolt gap epic (jolt-o3sw.9/.10), stacked on #697. Along the way it picked up three general bugs found running clj-uuid and mulog end to end.

  • #= read-eval (jolt-o3sw.10): the clojure reader's EvalReader, gated by read-eval, refused with the JVM's message when bound false. Loads interleave read/eval per form, so a #= in a later form sees earlier requires. The '#= is inert data' divergence entry is retired.
  • java.util.concurrent construction (jolt-o3sw.9): ArrayBlockingQueue (real bounded blocking queue, fiber-aware), FutureTask (run-once, blocking get, JVM cancel semantics), ThreadPoolExecutor ctor over the existing executor machinery with a live .getQueue view. Documented divergence: no RejectedExecutionException on overflow (internal queue is unbounded).
  • require prefix lists, vector spelling: [clj-uuid [bitmop :as bitmop] …] was read as a single libspec — a silent SELF-require mid-load with every alias dropped. Expansion now shared (ns.ss expand-libspec) by the loader, the build driver, and compile-eval's alias pre-scan.
  • dotted protocol-class spelling: (deftype T [] my.ns.PThing …) resolves to the protocol like the JVM; mulog's ConsolePublisher failed dispatch without it.
  • java.nio.charset.StandardCharsets constants (the charset name strings), and X/from statics for the core java.time types (from the paired time-repo PR malli time gaps: TemporalQuery parse, X/from, OffsetTime, strict zone ids time#9).

31 new corpus rows, all certified against OpenJDK 20 by the certify gate; make test green end to end. Downstream proof: clj-uuid v3/v4/v5/v6/v7 run bit-exact vs the JVM (with the new private jolt-lang/primitive-math fork + the crypto#4 digest fix), and mulog logs end to end with bit-exact flakes (private jolt-lang/mulog fork).

Yogthos added 7 commits August 22, 2026 13:39
The clojure reader's EvalReader: #=form reads its form and evaluates it on the
spot (clj-uuid computes its bit masks with #= about twenty times), refusing
under (binding [*read-eval* false] ...) with the JVM's message. EDN still has
no = dispatch. The eval entry point and the var cell live in later-loaded
files and resolve at call time; a load interleaves read and eval per top-level
form, so earlier requires are visible to a #= in a later form. The known
divergence entry for '#= is inert data' is retired (jolt-o3sw.10).
The shapes Grain's SQLite write coordinator constructs directly.
ArrayBlockingQueue is a real bounded blocking queue (offer/put/take/poll with
the timed variants, fiber-aware through jolt-cv-wait; take answers (v . #t)
internally so a false element stays distinct from a timeout). FutureTask is a
run-once task with a blocking get; cancel wins only before run starts (the JVM
can interrupt a running task, jolt cannot). The ThreadPoolExecutor ctor builds
on make-executor, sized by maximumPoolSize, keepAlive/factory/handler accepted
and ignored; submit/execute route a FutureTask through its own run. .getQueue
answers a live VIEW of the executor's internal queue — real depth, capacity
from the ctor's queue argument — because tasks flow through the executor's own
unbounded queue: the JVM rejects a submit when the bounded queue fills, jolt
queues it, and that is the documented divergence. 12 corpus rows certified on
OpenJDK 20 (jolt-o3sw.9).
[clj-uuid [bitmop :as bitmop] [clock :as clock] ...] is a prefix list on the
JVM — a vector is a single libspec only when its second element is a keyword
or absent. The old single-libspec read required the PREFIX itself, which for
clj-uuid meant a silent self-require mid-load with every sub-spec and alias
dropped, and 'Unknown class bitmop' at the first qualified call. The expansion
now lives in ns.ss (expand-libspec) shared by the loader's expand-spec, the
build driver, and compile-eval's alias pre-scan — the pre-scan and the gates'
alias-only require missed prefix lists in both spellings before this.
The constants ARE the charset name strings, which every jolt charset seam
(.getBytes, String ctors, stream readers) takes — so the constant composes
with all of them. clj-uuid's v3/v5 digest path calls
(.getBytes s StandardCharsets/UTF_8).
A deftype/reify may name a protocol by its class — mulog's ConsolePublisher
implements com.brunobonacci.mulog.publisher.PPublisher — and the JVM resolves
that to the protocol. protocol-key-of only tried the symbol as a var
reference, so the dotted spelling filed the methods as interface methods and
protocol dispatch answered 'No method publish-delay'. On a miss it now reads
the last segment as the name and the demunged prefix as the namespace and
looks the protocol var up there. Found running mulog under jolt-o3sw.12.
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