Closed bnjbvr closed 1 year ago
It's so we can implement Debug
for dyn Reflect
(https://github.com/EmbarkStudios/mirror-mirror/blob/main/crates/mirror-mirror/src/lib.rs#L577).
We could technically use https://github.com/EmbarkStudios/mirror-mirror/blob/main/crates/mirror-mirror/src/lib.rs#L1283 but using the Debug
impl directly from the type will give more precise output, specially if the reflection type uses ReflectRef::Opaque
. It might also be slightly faster.
Ok, so Reflect
types don't have to provide a Debug
implementation, but we can still get a free Debug
-like implementation for those types, based on the reflected fields (and in theory, we could add metadata in there, if we wanted to).
I'm looking at the code right now and I'm wondering why there's a separate notion of debug formatting for
Reflect
ables values? What are the benefits compared to letting the type implementingReflect
implementDebug
if they want to?