Hacker News new | ask | show | jobs
by forrestthewoods 417 days ago
Rust macros are a mutant foreign language.

A much much better system would be one that lets you write vanilla Rust code to manipulate either the token stream or the parsed AST.

1 comments

...? Proc macros _are_ vanilla Rust code written to manipulate a token stream.
You’re right. I should have said I want vanilla Rust code for vanilla macros and I want to manipulate the AST not token streams.

Token manipulation code is frequently full of syn! macro hell. So even token manipulation is only kind of normal Rust code.