Phase 13: Protocol Completion — reify dispatch, #() reader, IFn protocol
- reader.janet: rewrite read-anon-fn to handle % arg references % → gensym, %1/%2 → sorted gensyms, replaces all matching % refs - evaluator.janet: IFn protocol support in default invocation arm Before erroring "Cannot call X as a function", checks for: 1) type-registry IFn/-invoke method (extend-type protocols) 2) :jolt/protocol-methods :-invoke (reified objects) - test/phase13-test.janet: 4 test sections (28-31) 28: reify dispatch — protocol methods on reified objects 29: #() anon-fn — % and %1/%2 arg handling 30: extend-type — protocol method dispatch for deftypes 31: clojure.walk loading — keywordize-keys loads correctly - All pass: 316 ok, 1 fail (pre-existing, unchanged)
This commit is contained in:
parent
5d7f392666
commit
df1e836cda
7 changed files with 130 additions and 44 deletions
|
|
@ -36,6 +36,12 @@ janet test/phase10-test.janet # standard library
|
|||
printf "(range 10)\n[1 2 3]\n{:a 1}\n" | janet src/jolt/main.janet
|
||||
```
|
||||
|
||||
## Test File Creation — Heredoc Workaround
|
||||
|
||||
The `write` tool's syntax checker rejects `.janet` files with complex string escaping (e.g., `\"` inside Janet strings). **Workaround:** Use `bash` with `cat > file << 'EOF' ... EOF` heredocs for any test file containing Clojure source strings.
|
||||
|
||||
**Paren-counting boundary:** Large single-file test suites (>6 sections) often hit a mysterious paren-counting parse error ("unexpected end of source") at section boundaries, even when parens are balanced. **Workaround:** Split into multiple files (e.g., `cljs-port-1a.janet`, `cljs-port-1b.janet`).
|
||||
|
||||
## Loading .clj Files
|
||||
|
||||
`.clj` files are loaded via `eval-form` in the interpreter:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue