jolt/.dirge/memory/PITFALLS.md
Yogthos 794f60dff2 fix: vendor/sci submodule, defrecord fix, all tests pass
- Add SCI as git submodule at vendor/sci (replaces absolute path)
- Fix defrecord macro: emit array-map at expansion time, no interleave dep
- Remove stale test files (test-ctor, test-parser, edamame_shim)
- All 317 SCI forms load with 0 failures, 9 test suites green
2026-06-02 09:48:52 -04:00

1.3 KiB

Janet (put table key nil) silently drops the key — it's a no-op, not a way to store nil. This is SEPARATE from struct-nil-drop: even mutable @{} tables drop nil values on put. The bind-put helper in evaluator.janet stores nil as :jolt/nil sentinel; resolve-sym unwraps it back to nil. All binding put calls in fn*, let*, loop*, macro bodies, and deftype reify MUST use bind-put, not raw put. § Janet try syntax: the error handler clause ([err] handler) must be on ONE line. Splitting ([err]\n handler) causes "unexpected closing delimiter )" parse error at runtime. This is a Janet parser limitation, not a Jolt issue. Fix: always write (try body ([err] handler-body)) on one line, or use (do ...) for multi-line handlers: (try body ([err] (do ...))). § Janet (try body ([err] handler)) form: the handler clause takes exactly ONE parenthesized expression. (try (do ... :ok) ([err] (printf \"%q\" err) :fail)) is valid — the handler returns :fail. But (try (do ... :ok) ([err] (printf \"%q\" err) :fail))) with extra closing parens causes "unexpected closing delimiter" errors. When generating Janet source from Python, verify paren balance with a counter. Also: (def result (try ... ([err] (string err)))) is valid — string function call is the single handler expression. Getting this wrong wastes many iterations.