EmbarkStudios / mirror-mirror

🪞 Powerful reflection library for Rust
Apache License 2.0
79 stars 2 forks source link

Can `Typed` be renamed? #75

Closed bnjbvr closed 1 year ago

bnjbvr commented 1 year ago

Typed is a bit generic, and I'm not sure how to interpret it at a first glance, since everything's typed :grinning: Would it make sense to rename it to something more precise? My thinking was that it's describing how to be part of the type graph, so maybe it could be called TypeGraphNode / TypeGraphNodeBuilder (it's a mouthful), or as it relates to building the type descriptor, DescribedType. But I don't have any particular attachment to any name, and would be curious to hear your thoughts here.

Also wondering if Reflect should contain the type_descriptor API method which seems to always call into the Typed::type_descriptor. Would it suffice that Reflect require Typed on the type it implements, instead?

davidpdrsn commented 1 year ago

I kinda like Typed 🤷 It was taken from bevy_reflect.

DescribeType isn't too bad and matches TypeDescriptor.

Would it suffice that Reflect require Typed on the type it implements, instead?

You mean like trait Reflect: Typed? I'd really like that (same for FromReflect) but its not possible because Typed isn't object safe, so &dyn Typed isn't allowed.