this post was submitted on 19 Jan 2026
-1 points (47.4% liked)
Rust
7685 readers
43 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I can see that. I'm coming in from the other extreme that is Python, where even the meta-programming is done in plain Python.
I also come from python, actual meta-programming concepts are usually implemented via meta-classes, which I would describe as more complex than rust macros, in the "it takes longer to fully understand" sense.
You could also generate python code and execute it if you don't mind the obvious security implications, but that's only a possibility thanks to it being an interpreted language, while rust macros can provide validations and readable error messages out of the box.
To your post's point in general:
None | T) which require hand-written handling, instead of rust'sOption<T>which has convenience methods and syntax support (... = maybe?).I have more points if you'd like to understand my position, and am willing to explain if you need.
Part of why Python can do this is that it runs completely differently from Rust. Python is interpreted and can run completely arbitrary code at runtime. It's possible to
execarbitrary Python.Rust is compiled ahead of time. Once compiled, aside from inspecting how the output looks and what symbol names it uses, there's nothing that ties the output to Rust. At runtime, there is nothing to compile new arbitrary code, and compiling at runtime would be slow anyway. There is no interpreter built into the application or required to run it either.
This is also why C, C++, and many other compiled languages can't execute new arbitrary code at runtime.
@decoratorcomes to mind, and only the keyword is part of the language.Common Lisp has meta programming built-in but no one uses Common Lisp for a good reason.