You are viewing a single thread.
View all comments View context
9 points

Yeah, Rust can’t have proper reflection, since there’s no external runtime environment that keeps track of your state. Any such smartness either has to be compiled-in (which is how std::any and macros work) or you can implement something to keep track of this state at runtime, as if you were partially building a runtime environment.

permalink
report
parent
reply
12 points

Minor point of clarification: it can’t have runtime reflection, but in principle it could have compile time reflection.

permalink
report
parent
reply
1 point

And compile-time reflection will probably also continue to suck due to some irreconcilable limitations of type-safe generic specialization. Oh how I would love an equivalent to C++ template parameter packs…

permalink
report
parent
reply
0 points

No, the Rust Project recently made sure that Rust can’t have compile-time reflection.

permalink
report
parent
reply
1 point

Can you expand on this? I’d love to read more on the subject.

permalink
report
parent
reply
1 point

…yeah, that’s really unfortunate. Part of why I said “in principle”.

permalink
report
parent
reply

Rust

!rust@programming.dev

Create post

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits
  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

Community stats

  • 572

    Monthly active users

  • 812

    Posts

  • 3.7K

    Comments