3 ms·
Macros are extremely hard to grok and and so many use such short variable names that it looks like absolute gibberish. They also look so different than normal
by skrtskrt 5y ago
Macros are extremely hard to grok and and so many use such short variable names that it looks like absolute gibberish.
They also look so different than normal Rust code. Python metaprogramming still looks exactly like Python, for example.
- ReactiveJelly 5y agoOh yeah. I don't know if I've ever tried to implement a macro. The macro_rules syntax is hard to read and it doesn't feel like there are many examples explaining how it works.
- afdbcreid 5y agoThe Little Book of Rust Macros - https://veykril.github.io/tlborm/introduction.html https://veykril.github.io/tlborm/introduction.html.
- afdbcreid 5y agoMacro definitions can be hard to grok, but that's not usually what you look on. Macro uses can be hard, but macros are not used commonly in Rust (I mean, there are not many macros - but those that exist are very common). And they also look very much like Rust: `vec![a, b, c]` vs. `[a, b, c]`, `zip!(a, b, c)` (itertools) vs. `zip(a, b)` (`std::iter::zip()`), `#[tokio::main] async fn main() {}` vs `fn main() {}`... Attribute procedural macros only accept valid Rust syntax, and most of them are derive macros that just derive some trait.