s-expressionists / Eclector

A portable Common Lisp reader that is highly customizable, can recover from errors and can return concrete syntax trees
https://s-expressionists.github.io/Eclector/
BSD 2-Clause "Simplified" License
109 stars 9 forks source link

QUASIQUOTE can't handle circular lists #60

Open Bike opened 4 years ago

Bike commented 4 years ago

Macroexpansion of (quasiquote #1=(#1#)) dies. This is because expand immediately calls itself on the car and cdr of its argument if given a cons.

I suppose it's debatable whether quasiquote should be able to handle this, but we ran into it due to some code in the Alexandria tests: https://github.com/keithj/alexandria/blob/0426bd2fae19ae0492d44407f17ac1005196c9c3/tests.lisp#L677 (i mean, maybe. The path from that code to the crash is not totally clear yet, and there's no obvious backquoting there.)

Clasp issue: https://github.com/clasp-developers/clasp/issues/885

scymtym commented 4 years ago

The alexandria test is probably hitting a problem in CST.

But yes, (quasiquote #1=(#1#)) could work since it is basically just '#1=(#1#). Introducing unqoute within the circular part would be too hard to understand for me.