Pre-RFC proc-macros with side effect

Some alternatives that weren't mentioned:

The expanding order could change at any time, I don't think it would be wise to document it. If anything it would be nice to force proc-macros not to depend on it. For example an idea that was floating around in Idea: stateful procedural macros was to have each proc macro produce a payload that would then be reduced at the end with some sort of associative operation.


This also ignores the need for caching the result of deterministic proc-macros, which are the vast majority and IMO should be the default behavior. Note that this has been showed to be highly beneficial for compile times.

5 Likes