Hacker News new | ask | show | jobs
by spacechild1 27 days ago
> You can do everything you can do with C++ static reflection.

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?

1 comments

It's hard to be concrete without talking about something specific. At the limit, in stable Rust (for 8 years?), a proc_macro consumes and emits an arbitrary token stream at compile time; it's not ergonomic, but it's possible.

The equivalent in C++ is in the realm of arbitrary codegen.