Why are macro_rules! scope rules so cursed
I’ve been a Rust programmer for several years. I love the language but one rough area has always been macros. I have a particular question though about why scoping works the way it does with macros.
In order to export a macro for use, you must do one of two things:
- `#[macro_export]` which just dumps it at the root of the crate
- Define the macro then `pub use` it after (not before)
Why are the scoping rules so cursed? Nothing else in the language works this way. Why can’t you just do `pub macro_rules! my_macro` …
I know Macros 2.0 are supposed to fix this but that feature basically looks stalled and I don’t have high hopes it’ll ever be finished (like so many unstable features).