<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> getting flashbacks to <a href="https://github.com/eddyb/sobek/blob/main/src/ir/build.rs" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">github.com/eddyb/sobek/blob/ma</span><span class="invisible">in/src/ir/build.rs</span></a> (and older shit that was even worse)</p><p>that one file mostly just generates a bunch of `struct`s and `impl`s (via `macro_rules!`) to allow `a + b * c` to be like `Add(a, Mul(b, c))`, except much messier to avoid needing a million `impl`s</p><p>idk if there's a clean use of it but e.g.:<br /><a href="https://github.com/eddyb/sobek/blob/7ed003a22fbe5414c136ca179fe518ef49009ae6/src/isa/i8051.rs#L407-L416" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">github.com/eddyb/sobek/blob/7e</span><span class="invisible">d003a22fbe5414c136ca179fe518ef49009ae6/src/isa/i8051.rs#L407-L416</span></a></p><p>`cx.a(...)` is "allocating" (well, interning but that's irrelevant) whatever mess (e.g. mix of operators/methods) is passed to it in `cx`</p>