robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 79 forks source link

Macro bodies don't deal with declarations correctly #141

Closed Bike closed 3 years ago

Bike commented 5 years ago

First, in CST-to-AST, the function for building a macroexpander from a macrolet binding wraps the body in a progn. This means that any declarations will be treated as function calls. For example, in clasp (per report: https://github.com/clasp-developers/clasp/issues/781) compiling (macrolet ((m (foo) (declare (special *foo*)) foo)) (m 42)) triggers warnings about undefined functions declare and special.

Second, the underlying cst:parse-macro itself is unable to deal with declarations. While this example is a free declaration, there could be bound declarations as well. That's not in the SICL project strictly speaking, though.

macrolet bindings can certainly have local declarations, as per the CLHS page, so this is nonconforming behavior.

Bike commented 3 years ago

This was fixed by s-expressionists/Concrete-Syntax-Tree#17, I think. Maybe also s-expressionists/Concrete-Syntax-Tree#15 as well.