samrushing/irken-compiler

macros expanding in binding positions

samrushing opened this issue · 1 comments

for-list expands into a form like (let ((thing _)) ..., and the macro expander is too eagerly expanding thing when it is in a variable-binding spot. Either the macro expander needs to be calmed down, or (more likely) macro expansion needs to alpha rename every symbol.

(defmacro thing
  (thing x) -> (zurg x x)
  )

(for-list thing '(1 2 3 4)
  thing
  )
syntax error
***
Runtime Error, halting: "let_subst (zurg m126 m126) (begin thing ($loop0 $tl2..."

It was a simpler problem: let_subst was not protecting its 'bindings' from macro expansion.
Fixed with commit 345e5d3