Source transformation API (comptime? macro?) #2082
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Hello, I believe this is tangentially but not directly related to issue #2029. 2029 may be a subset of this question, in fact.
A friend has recently been introducing me to Julia's interesting macro-like tools for inspecting the lowered / macro-expanded / LLVM / native transformations their runtime JIT performs on interpreted source code. It's fascinating what they are doing. For a couple of examples of what it enables -- https://github.com/jrevels/Cassette.jl and http://blog.rogerluo.me/2018/10/23/write-an-ad-in-one-day/
I think that some such tools would be useful for Zig. Offering some API and well-defined datatypes around expansion / inspection of source transforms performed by the Zig compiler would supercharge much more than debugging. If the API is accessible to
comptime
fns, this could open up incredible metaprogramming features to library contributors. If the API is simply to link various stages in the self-hosted compiler, I suppose I could tolerate it with minimal complaint.This would also open the door to a wide variety of well-designed static analysis tooling.
Perhaps this is out of scope of the design of the language, but it struck me as a fascinating feature.
The text was updated successfully, but these errors were encountered: