253
C++ superiority
(lemmy.nz)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
To be fair, with Rust macros anything goes. There was an example where someone demoed descriping rust structs and enums nested as xml with a macro to parse it.
I always enjoy this one: https://crates.io/crates/inline-python
Apparently, Python's syntax is almost entirely a subset of Rust's syntax + a few keywords, so even though you have to pass valid Rust tokens into a macro, that's good enough to write Python with just a few quirks.
That's inside the macro though. Whatever you parse inside the macro is defined by the creator of the macro. The macro invocation itself is defined by the rust language.
Rust allows you to use any bracket because it doesn't know what the macro is supposed to do.
Some macros work like functions:
Some macros work like array declarations:
And some macros work like a code scope:
Since rust doesn't know what your macro does, it just lets the user choose whatever the user sees more fitting for that specific macro invocation.