Re:Maud: A Rust macro for writing HTML
by shepmaster on Tuesday June 07, 2022 @09:09AM
(#31653705)
> println! is a macro, and doesn't "break the tooling"
I like, use, and write macros, but this isn't fully true. For example, recent Rust versions allow writing identifiers directly in the format string:
println!("{some_identifier}")
However, this breaks rust-analyzer's ability to rename variables [1].[1]: https://github.com/rust-lang/rust-analyzer/issues/11260#
Re:Maud: A Rust macro for writing HTML
by tialaramex on Tuesday June 07, 2022 @06:22AM
(#31652116)
println! is only a declarative macro, whereas Maud is a proc macro.
The declarative macros aren't too head-twisting for tools, they just expand as declared, this can sometimes have a few surprising effects but generally it is very manageable. Procedural macros have essentially unlimited power and thus are sometimes entirely impossible to analyse.
println! depends on a proc macro: https://doc.rust-lang.org/stable/src/core/macros/mod.rs.html...
Re:Maud: A Rust macro for writing HTML
by tialaramex on Wednesday June 08, 2022 @03:41AM
(#31664455)
I see a built-in there. Are you really seeing a proc macro?
I don't remember experiencing Rust Analyzer crashes for a long time, though (I do remember some in the past).