Skip to content

Conversation

@aaronfranke
Copy link
Member

I tried to duplicate a const PackedStringArray and I noticed that it was impossible, but it should be possible.

@aaronfranke aaronfranke requested review from a team as code owners July 7, 2023 04:12
@aaronfranke aaronfranke added this to the 4.x milestone Jul 7, 2023
@AThousandShips
Copy link
Member

AThousandShips commented Jul 7, 2023

Needs an update to the extension API validation

Also, do we need to add a 4.1 one as well now that we have released it, along with 4.0

@akien-mga
Copy link
Member

@godotengine/gdextension Does this technically break compat for extensions?

@raulsntos
Copy link
Member

If the method's hash changed, then I guess it breaks compat. Otherwise, a GDExtension that was built for 4.1 making use of ClassDB::get_method_with_compatibility passing the old hash will not be able to find the method in 4.2.

To avoid breaking compat, you would need to add a compat method (see #76577).

@dsnopek
Copy link
Contributor

dsnopek commented Jul 7, 2023

Does this technically break compat for extensions?

Yes, I think @raulsntos is correct.

I guess it's time to start testing out this compatibility system for real?

@aaronfranke
Copy link
Member Author

What is the correct way to add compatibility methods? Is there an example I can follow?

@dsnopek
Copy link
Contributor

dsnopek commented Sep 7, 2023

Hm, digging into this one deeper, I don't think we currently have a way to provide compatibility methods on Variant types.

gdextension_variant_get_ptr_builtin_method() in gdextension_interface.cpp looks up the method by the name, recalculates its hash, and simply compares that with the value provided. We'll need to add something to variant_call.cpp to store, register and call compatibility methods, similar to the mechanism we already have in ClassDB.

@aaronfranke aaronfranke force-pushed the vec-dup-const branch 3 times, most recently from eb11ddc to f113dca Compare October 5, 2024 01:36
@aaronfranke aaronfranke force-pushed the vec-dup-const branch 2 times, most recently from b37ee51 to 55a3669 Compare December 18, 2024 07:45
@aaronfranke aaronfranke force-pushed the vec-dup-const branch 2 times, most recently from 985a9be to 8813d1b Compare February 15, 2025 16:28
@aaronfranke aaronfranke force-pushed the vec-dup-const branch 3 times, most recently from 4511362 to d57af73 Compare April 10, 2025 08:35
@aaronfranke aaronfranke force-pushed the vec-dup-const branch 2 times, most recently from 744946c to 49f8cc1 Compare May 2, 2025 23:17
@aaronfranke aaronfranke force-pushed the vec-dup-const branch 2 times, most recently from fde1afa to 02ea09b Compare May 16, 2025 09:47
@aaronfranke
Copy link
Member Author

Since there still isn't a way to register compatibility methods, I updated this PR to instead keep the bindings equivalent to the same method as before, while the version internal to the C++ code is now const. There are #ifndef DISABLE_DEPRECATED checks to ensure that the compat method is removed when building with deprecated disabled.

@aaronfranke aaronfranke marked this pull request as ready for review August 19, 2025 15:40
@dsnopek
Copy link
Contributor

dsnopek commented Sep 17, 2025

Since there still isn't a way to register compatibility methods, I updated this PR to instead keep the bindings equivalent to the same method as before, while the version internal to the C++ code is now const.

So, essentially, this makes it const within Godot, but still non-const as exposed to GDExtension?

@dsnopek
Copy link
Contributor

dsnopek commented Nov 1, 2025

I just posted PR #112290 which finally adds a system for builtin method compatibility.

In order to test in, I've included (in the 2nd commit) the same core change as this PR (and listed @aaronfranke as a co-author)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants