I’m fascinated by Rust metaprogramming!

It has trait-based generics, which are safer and much more convenient than C++ templates. It also has rule-based macros which are safer and much more powerful than those of C/C++. And as if that wasn’t enough it also has procedural macros! Those are comparable to C++ templates in power (quite literally: both are Turing-complete) but this time, it’s not some pattern matching but a full-fledged program that can directly do arbitrary transformations — except not exactly arbitrary, safety checks are still there so it won’t end up with a missing closing bracket or such. And for those with special needs, pretty much all of that machinery is also available “offline”, essentially as a code generation framework.

Now, of course there are rough edges. Traits, while incredibly flexible have their limits. And macros only operate syntactically, not semantically. There appears to be no good way to do complex transformations at semantic level. While trait specialization can help, not only it’s not a solution for everyone it’s also a huge can of worms on its very own. It’s actually one of reasons C++ templates are so hard to work with: anything can be specialized, anywhere. Now, Rust does put a stop on the latter part: as I understand it specializations are still governed by the orphan rule so, there are only so many places for each. The former part is also tamed, specialization is strictly opt-in as proposed. But I’m still somewhat uneasy.