So, a build system would pre-process a PS program using an external tool? I think this means whatever language the meta-programming system is written in would need to have a full PS-lang parser or pretty-printer. It’s interface would be something like PureScriptString -> PureScriptString. That sounds a bit like a hurdle, but a reasonable ask.
At first glance, then, it seems the big advantage of having a hook in the compiler for this, like a suggested a post above, would be to make an external meta-programming tool easier to write, as the compiler could pass the parsed PS AST directly to the tool for transformation, like PSAST -> PSAST. (this sounds like Template Haskell
)
This latter concept presumes the embedded language is a successfully parsed PureScript expression, while the former would allow embedding an expression in any custom language into a PureScript program. If we want to avoid prescribing Template Haskell, then the former (like I would prefer) sounds like an obvious way to go.
I’m probably missing a big point here, though, as I’m not familiar with many meta-programming facilities of languages.