3 ms·
First, bear in mind that there's no way to obtain or return an AST, so you're extremely limited in terms of what you can provide in a DSL. If you want to do any
by Ralith 15y ago
First, bear in mind that there's no way to obtain or return an AST, so you're extremely limited in terms of what you can provide in a DSL. If you want to do anything beyond a certain level of complexity, the library user will have to pass in everything as string literals, and even then there are issues; your library's API will be indistinguishable from one that operates at runtime, but be much harder to implement, for starters.
Additionally, though this may have changed since, last time I used D extensively the CTFE was plagued by performance issues and memory leaks. In fact, it was ran with no GC at all.