4 ms·
I think Andrei Alexandrescu's comment that Rust "skipped leg day" is still mostly true (Rust does what it set out to do better than anyone else but the metaprog
by mhh__ 6y ago
I think Andrei Alexandrescu's comment that Rust "skipped leg day" is still mostly true (Rust does what it set out to do better than anyone else but the metaprogramming in particular isn't very attractive)
- nindalf 6y agoPeronally I feel more comfortable writing metaprograms in Rust than any other language. Could you elaborate?
- ncmncm 6y agoRust macros have no access to types at all. Types are essential for any but the most trivial metaprogramming.
- redrobein 6y agoCan you give a specific example of this?
- raphlinus 6y agoIf you consider the scope of metaprogramming to include both macros and traits (and I do), then this is seriously understating the case. Rust's type system has a Prolog-like core and is Turing complete, so is quite expressive in able hands. A great example of the two features working together is serde, which automatically derives serialization and deserialization code (with custom overridable behavior such as defaults) for a very wide range of types. It's also something like 20-50x faster than Swift's Codable based implementation of JSON.
- ncmncm 6y agoI guess I do, too, now. It has got more powerful since I last looked.