|
|
|
|
|
by cogman10
22 days ago
|
|
> I don't think Rust has static reflection. Before C++ in fact through procedural macros. You can do everything you can do with C++ static reflection. Now, it could be better. Proc macros require you to pull in secondary packages for parsing the token stream. But all the sorts of operations you can do via static reflection you can do via proc macros. That's how the most popular rust serialization package like serde works. It's also how some more popular database libs work like sqlx. > Also, aren't const generics much more limited? I've also heard there is no template specialization and no "if constexpr". Both have been added and expanded. AFAIK they are now roughly on par with what C++ const expressions can do. What they can't do, proc macros can do. > Or what about dynamic allocations in constexpr functions? IDK if that's possible in rust. Const expr capabilities of rust have been rapidly expanding though in the last year. |
|
Are you really sure about that?
I have a slight problem with such sweeping statements and also with your original claim that "Rust's metaprogramming capabilities are now on par with C++". I think you can only make such claims if you know both languages really, really well.
That being said, I acknowledge that Rust's metaprogramming capabilities have improved significantly in recent years.
> Both have been added and expanded.
In stable Rust?