Chez Phase 2 (inc O): host String methods (jolt-nfca)

Port the java.lang.String/CharSequence method surface to the Chez RT so
(.toUpperCase s), (.substring s a b), (.indexOf s x), the regex methods
(.matches/.replaceAll/.replaceFirst/.split), etc. run on a string target.

natives-str.ss holds jolt-string-method, ported from the seed's surface in
eval_resolve.janet: ASCII case mapping (byte-oriented like the seed), -1 on
indexOf miss, flonum numeric returns to match jolt's number model, Scheme
chars for charAt, and the regex methods over the irregex compiled via
jolt-re-pattern. record-method-dispatch gains a string? arm that falls
through to it (unsupported methods still throw).

Corpus prelude floor 2002 -> 2026 (+24), 0 new divergences. _str 27/27 vs
build/jolt; full jpm test + conformance x3 green.

The (. x m) dot-form (the . special form, distinct from .method sugar) and
the clojure.string namespace (needs prelude plumbing + Pattern) stay deferred.
This commit is contained in:
Yogthos 2026-06-18 20:36:39 -04:00
parent b7158e0690
commit 3ab53ba938
6 changed files with 209 additions and 2 deletions

View file

@ -195,8 +195,13 @@
# with-in-str/line-seq) 2000.
# jolt-fmm4 ((type x) — :type meta override, record ns-qualified class-name
# symbol, total value->taxonomy keyword mapping) 2002.
# jolt-nfca (host java.lang.String method interop — jolt-string-method, the
# portable String/CharSequence surface record-method-dispatch falls through to on
# a string target: case/trim/length/indexOf/substring/startsWith/contains/replace/
# charAt/equalsIgnoreCase + the regex methods matches/replaceAll/replaceFirst/
# split) 2026.
# Strided runs scale down.
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2002")))
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2026")))
(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)))