axellang / axel

Haskell + Lisp
https://axellang.github.io
BSD 3-Clause "New" or "Revised" License
205 stars 9 forks source link

Quasiquotations are inadvertently expanded #73

Closed jgrosso closed 4 years ago

jgrosso commented 4 years ago

Because the parser expands quasiquotations, and we run Axel source through the parser to convert it, e.g. `(=macro ~name (~args) ~@body) is converted into (AST.SExpression (GHCPrelude.Just (, "src/Axel.axel" (SM.Position 22 55))) (concat [['=macro] [name] [(AST.SExpression (GHCPrelude.Just (, "src/Axel.axel" (SM.Position 22 69))) (concat [[args]]))] (AST.toExpressionList body)])))... which is less than ideal.

~~Is there a foolproof way to undo quasiquotation? Is it OK if we accidentally "unquasiquote" manually-user-generated code (in the rare case that a user's code happens to replicate the behavior of quasiquote)? (Maybe a good heuristic is: If the metadata is Nothing or not a literal value (e.g. it references a variable or something), it's user-generated; otherwise, replace it with quasiquote? Can we safely tell the users that any custom metadata literals they provide may be changed without notice?)~~

We will have a flag (etc.) for the parse methods that will disable quasiquote-expansion, (maybe hygenisization,) etc.