#227 Baked image: symbols TYPE and NAME collapse to keywords :TYPE/:NAME through macro splice

open
Opened by atgreen

Summary

In the IMAGE-BAKED binary (build/funcl), the symbols type and name — when passed through a macro's quasiquote splice — evaluate as the keywords :type/:name instead of resolving their lexical binding. build/funcl-stage2 (runtime, not image-restored) is CORRECT. So this is a save-image/restore symbol-canonicalization bug, in the ADR-0026 symbol-unification class.

Minimal repro

(defmacro m (b) `(progn ,b))
(let ((type 9)) (m type))    ;; build/funcl => :TYPE   (WRONG)   | stage2 => 9 (correct)
(let ((name 9)) (m name))    ;; build/funcl => :NAME   (WRONG)   | stage2 => 9
(let ((foo  9)) (m foo))     ;; both => 9
(let ((class 9)) (m class))  ;; both => 9   (only TYPE and NAME affected)

Also reproduces via let* and destructuring-bind (both nest lets / splice the body through quasiquote); plain let and lambda are fine (binding var + body ref share one reader pass). At read time (keywordp 'type)=>NIL and (eq 'type :type)=>NIL — the collapse happens only when the symbol travels through a baked macro-expansion splice.

Why TYPE and NAME specifically

:type and :name are heavily used as internal tags (mini-clos slot descriptors, IR nodes). The hypothesis: during save-image, the symbol-canon table entry for name "TYPE"/"NAME" ends up pointing at the KEYWORD record, so a restored reference to the non-keyword symbol resolves to the keyword (self-evaluating) → :type.

Impact

Low for the current asdf goal: asdf is probed on stage2 (the canonical target — build/funcl has #209), where this does NOT manifest. But it means build/funcl mis-runs any code that splices a type/name symbol through a macro (destructuring-bind (type name ...) among them). A build/funcl-only asdf load cores at the first define-package — this is #209 territory, tracked separately.

Related

Same class as ADR-0026 (single-canonical-symbol), the KEYWORD one-door (e197109), and #209 (image-restored mini-clos registries). Likely fixed by the same canonical-symbol work; recorded here as a concrete, minimal, deterministic repro.

Comments (1)

atgreen3992785829

ASSESSMENT 2026-07-11: baked-image symbol/keyword collapse — same image-fidelity family as #209. Today's related work: closure records got image serialization (tag 7, 1bdc303), and the cave#243 keyword home-pkg fix is adjacent code. VALIDATION of any image work is currently blocked by #288 (save-image segfaults at stage1 at clean HEAD — filed today with gdb evidence). Suggest tackling #288 first, then re-testing this and #209 against the fixed save path.