-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Would it be possible to make AudioFrame: Clone + Copy
?
#404
Comments
Yeah, I don't see why not. This affects all native types, not just Should be a small change, I can try to integrate it into one of the PRs. |
Was thinking of taking this on as a first dip in contributing. Are there any types that SHOULDN'T be |
Yes, class types can't be Copy/Clone, because we cannot create values of them (just references). Native structure types should be at least Clone. We can consider Copy, but some of them are bigger and this could potentially lead to large copies? Pointer shouldn't matter here. I would start with Clone only. People typically create native structs once and pass them. |
I figured that classes couldn't, was only going to for the native types listed above. was gonna do Clone for all, maybe PartialEq for all? Copy for AudioFrame and ObjectId. Was also gonna do Eq, PartialOrd, and Ord for ObjectId since it's just a u64, and those comparisons are reasonable. I also split up the fields while going through These are all in the .gitignore by default as well, should I be changing something in the codegen or in the end files themselves? |
I would like this to be fully automated (no special cases) and simple in its implementation (no extra-smart heuristics to find out if a type can implement a certain trait or not). Reason is to avoid extra maintenance overhead whenever something on Godot's native type definitions changes, or new types are added. I already need to go ridiculous lengths for enums, no need to have this for every single niche API. So, the traits can be: If any of these causes problems in the future, we can revisit that, but otherwise YAGNI.
This is by design. Being generated code means you can't manually change their definition, hence my rationale above. You would need to adjust
We could add a conversion to By the way, from your previous message:
Just because it contains |
Awesome, thanks for all the clarification! The goal of automation makes the path much clearer. I also knew EDIT: Just looked at classes to be consistent with where I put the
Builds fine with |
Yes,
I was looking into that again -- but it turns out it's not a good idea to provide So yes, the |
Currently, the code generation seems to generate
AudioFrame
asWould it be possible the
derive(Clone, Copy)
here, perhaps alsoPartialEq
? This would make a few things easier, and typically for a pair of floats implementingCopy
should be fine. Or is there a reason why this must not be done?The text was updated successfully, but these errors were encountered: