4 ms·
Reflection is not possible in Rust?
by _random_ 12y ago
Reflection is not possible in Rust?
- pcwalton 12y agoIt is somewhat supported at the moment, but it's experimental and we may remove the support for it. Reflection always carries an overhead in terms of binary size and as a result many of us feel that it's inappropriate for a low-level systems language like Rust.
- Arelius 12y agoIn theory, given the attribute, and macro system, it should be possible to implement this as a library in the language, correct? I think that is vastly preferred over a constant runtime always hanging around.
- keeperofdakeys 12y agoIf you are unaware, the base-language of Rust lacks a runtime. This limits what can easily be done in terms of reflection, when compared to languages like C# and Java.
- chrismorgan 12y agoRuntime reflection is rarely a good idea—it’s just that most languages don’t support any forms of compile-time reflection. Rust does have those tools, and has the power to replace the vast majority of cases where runtime reflection is used with compile-time behaviour.