-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Typed
, TypePath
, GetTypeRegistration
, etc etc supertraits of Reflect
#12691
Comments
Reasons not to do this include separating concerns (i.e. The former is nice to have, but it does make working with generic type bounds a little cumbersome. Not to mention, manual implementors often forget to implement a trait that they actually need in order for something to work as expected. Merging these into The bigger problem is the latter. Certain types can't or shouldn't implement certain traits. For example, It might also be worth waiting for Unique Reflect (#7207) to see if these issues regarding dynamic types can be mitigated by that PR (such as only merging traits into |
Tried experimenting with this, here's the results:
Overall I agree that Unique Reflect seems to be addressing most of these issues (except maybe |
|
Yes that was the idea, but |
What problem does this solve or what need does it fill?
Often just a
T: Reflect
bound is not sufficient. #5772 has a good example of why this is an issue.What solution would you like?
Have
Reflect
require all those traits, as it (almost?) never makes sense to implementReflect
without them. They are also all automatically derived when derivingReflect
(the only exception beingFromReflect
). #5772 claims this wasn't done because those traits are not object-safe, but this can be solved by just slapping somewhere Self: Sized
on the offending methods.What alternative(s) have you considered?
Reflect
The text was updated successfully, but these errors were encountered: