> What are the use cases?

There are four main things I can think of:

  * Parsing trees with mixed semantically-valid and DSL code (e.g. the prior 
example)
  * Including generated code from a cache that must be programmatically 
retrieved (such as Nimterop/Futhark etc.) with better semantic analysis. IIRC 
`parseExpr` & co. do not do the semcheck. Generating raw `include` directives 
to a cache may be difficult.
  * Macros that may need utilization of constant-folded expressions in _the 
context of some specific code_ where otherwise deferring to the standard NimVM 
CTFE context would be unwieldy. I'm not sure that the constant-folding effect 
performed in `typed` was ever documented, but IIRC Nimterop was also another 
example of this potentially being useful when it came to `enum` generation 
Nim-side.
  * Debugging macros by checking if specific subtrees pass semcheck. 
Technically this might be unnecessary, one can might as well return the 
subtrees from a macro body normally if they work in the invoked scope and see 
if the compiler likes it or not.


Reply via email to