docs: clarify fn*/let*/loop* take plain symbols only (jolt-f79)
grammar.ebnf: the destructuring note already attributed patterns to the binding MACROS; make the boundary explicit — the fn*/let*/loop* PRIMITIVES they desugar to take plain symbols only (a non-symbol binding errors, as in Clojure). self-hosting-compiler.md: the 'compile destructuring via a shared destructure expander instead of falling back' item is done (and its jolt-7dl ref was stale) — destructuring now compiles through the fn/let/loop/defn macros' desugaring; the primitives reject patterns.
This commit is contained in:
parent
d1d3f390ff
commit
8a9e386fa7
2 changed files with 10 additions and 5 deletions
|
|
@ -164,8 +164,11 @@ feature = ":clj" | ":cljs" | ":default" | keyword ;
|
||||||
tagged-literal = "#" , symbol , ws , form ;
|
tagged-literal = "#" , symbol , ws , form ;
|
||||||
|
|
||||||
(* ── Destructuring (semantics, not reader syntax) ────────────────────────────
|
(* ── Destructuring (semantics, not reader syntax) ────────────────────────────
|
||||||
The reader produces plain vectors and maps; the binding forms (let, fn, loop,
|
The reader produces plain vectors and maps; the binding MACROS (let, fn, loop,
|
||||||
doseq, for, defmacro params, …) interpret them as destructuring patterns:
|
doseq, for, defmacro params, …) interpret them as destructuring patterns. The
|
||||||
|
PRIMITIVES they desugar to — fn*, let*, loop* — take plain symbols ONLY (a
|
||||||
|
non-symbol binding is an error, as in Clojure: "fn params must be Symbols" /
|
||||||
|
"Bad binding form, expected symbol"). The grammar of a pattern:
|
||||||
|
|
||||||
binding = symbol | seq-binding | map-binding ;
|
binding = symbol | seq-binding | map-binding ;
|
||||||
seq-binding = "[" , { binding } , [ "&" , binding ] , [ ":as" , symbol ] , "]" ;
|
seq-binding = "[" , { binding } , [ "&" , binding ] , [ ":as" , symbol ] , "]" ;
|
||||||
|
|
|
||||||
|
|
@ -150,9 +150,11 @@ linking is opt-in, never the default, so the REPL is always live.
|
||||||
2. **Hybrid fallback + coverage** (`jolt-1bj`) — *done*. Forms the compiler can't
|
2. **Hybrid fallback + coverage** (`jolt-1bj`) — *done*. Forms the compiler can't
|
||||||
compile throw `jolt/uncompilable` and fall back to the interpreter, so compile
|
compile throw `jolt/uncompilable` and fall back to the interpreter, so compile
|
||||||
mode is always correct. Covered: multi-arity/named/variadic fns, `recur` in
|
mode is always correct. Covered: multi-arity/named/variadic fns, `recur` in
|
||||||
`fn`, map/vector literals, and resolution matching the interpreter. (One
|
`fn`, map/vector literals, and resolution matching the interpreter.
|
||||||
optimization left: compile destructuring via a shared `destructure` expander
|
Destructuring compiles via the shared `destructure` expander: the `fn`/`let`/
|
||||||
instead of falling back — `jolt-7dl`.)
|
`loop`/`defn` macros desugar to plain-symbol `fn*`/`let*`/`loop*`, so it no
|
||||||
|
longer falls back — and the primitives reject patterns outright, matching
|
||||||
|
Clojure (`jolt-f79`).
|
||||||
5. **Compile-by-default + AOT** (`jolt-7j9`) — *done, done out of order*. Once the
|
5. **Compile-by-default + AOT** (`jolt-7j9`) — *done, done out of order*. Once the
|
||||||
hybrid path was validated at parity, compilation was flipped on by default and
|
hybrid path was validated at parity, compilation was flipped on by default and
|
||||||
AOT images (`aot.janet`) landed. Done before 3–4 because it's the runtime
|
AOT images (`aot.janet`) landed. Done before 3–4 because it's the runtime
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue