Skip to content

Tuples don't get ReflectFromReflect type data registered in GetTypeRegistration #17981

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

Open
makspll opened this issue Feb 22, 2025 · 2 comments
Labels
A-Reflection Runtime information about types C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@makspll
Copy link
Contributor

makspll commented Feb 22, 2025

Bevy version

0.15.1

Summary

i.e.

registry.register_type::<(usize,usize)>();

will not register a ReflectFromReflect type data against the tuple.

for it to take, you have to manually do it via:

registry.register_type_data::<usize, ReflectFromReflect>

This means if I want to construct arbitrary types like:

stuct MyStruct {
    pub foo: (usize,usize)
}

I have to always do that manual registration

@MrGVSV
Copy link
Member

MrGVSV commented Feb 22, 2025

Unfortunately this might be difficult to do since we want GetTypeRegistration to work even if not all tuple fields are FromReflect. But in order to register ReflectFromReflect automatically, we have to add the FromReflect bound.

We'd need something like specialization or just flat out require FromReflect on tuples.

@MrGVSV MrGVSV added A-Reflection Runtime information about types S-Needs-Investigation This issue requires detective work to figure out what's going wrong D-Complex Quite challenging from either a design or technical perspective. Ask for help! C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled C-Bug An unexpected or incorrect behavior labels Feb 22, 2025
@makspll
Copy link
Contributor Author

makspll commented Feb 22, 2025

Ahh.. figured there was a good reason!

If I had a penny every time I wished specialization was a thing, I'd be rich!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

2 participants