jolt/.dirge/memory/PITFALLS.md
Yogthos 1de109f261 Bug fixes: nth, list, name, subs support in compiler
- core.janet: add core-nth function + nth binding (was missing entirely)
- compiler.janet: add list, name, subs to core-renames and core-fn-values
- compiler.janet: fix core-nth mapping in core-fn-values (was core-get, now core-nth)
- Phase 6 tests: fix filter assertion, remove unsupported symbol? test
- symbol? with quoted symbols: Janet symbols ≠ Jolt symbol structs
- All 317 tests pass, 0 failures
2026-06-02 16:30:25 -04:00

1.1 KiB

Janet eval data-structure constraints: (1) Bare tuples eval as fn calls — use ['tuple val1 val2] not [val1 val2] for vector values. (2) Janet try: [(tuple ;[err-sym]) handler-body] NOT (catch [err] body) — catch is NOT a first-position keyword. (3) quote in compile-ast: use raw-form→janet converter (map Jolt reader structs → Janet symbols) — don't re-analyze. (4) eval runs in default env, doesn't see use-imported symbols. FIX: embed fn values directly via core-fn-values table. § When you need to mutate a local with set, use (var x nil) not (def x nil). def creates constants — (set ns-name ...) on a def fails with "cannot set constant". This hit us in loader.janet ns-name extraction loop. § core-renames MUST match actual function names in core.janet. "-"core-sub NOT core--. "fn?" was missing entirely (caused silent nil). Missing entries → symbol treated as unknown global, returns nil. When adding: grep core.janet for actual (defn core-XXX) name, add to BOTH core-renames (string table) and core-fn-values (fn value table).