-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
[3.x] Support deep comparison of Array and Dictionary #42625
Conversation
7e4e972
to
c76b7b8
Compare
I'm willing to rework the PR anytime needed to have it merge as soon as possible ;-)
😘
I have the feeling In the end I'm ok to change the name, but I'd like some additional opinion on the topic if possible before doing so ;-) |
Nice. If this gets merged I can dump my compares from my GDScript function library.
That's more descriptive about it's implementation, rather than what it provides. I feel the adjectives aren't really needed. Additional implementation and parameter detail can be provided in it's doc entry. For what its worth, the following signatures seem fine to me. |
44700d6
to
1156a08
Compare
1156a08
to
b8ab122
Compare
@touilleMan, I've rebased this. By now I have already lost track of the additional changes you've made to your PR for 4.0. Could you please take a look and confirm this is not missing any important piece from yours? |
81d3f59
to
169ee5e
Compare
169ee5e
to
c90993f
Compare
...and expose it to GDScript. Co-authored-by: Emmanuel Leblond <[email protected]>
c90993f
to
a02bb2b
Compare
Thanks! |
I was just wondering if deep_equals() with an "s" at the end has more meaning than deep_equal(). |
For the member functions (not exposed to scripting) I agree that |
This is a revival of #35816, but for 3.x. As such, it's just a safe subset of it; namely, recursive comparison is added to
Dictionary
andArray
, but instead of changing how comparison currently works on them, it adds specialdeep_equal()
functions, that one can use if desired.And this PR indeed leverages
deep_equal()
in the following situations:deep_equal()
GDScript global function.Some extra notes:
==
works inDictionary
,Array
andVariant
in 3.2 because that would be a compatibility breakage, this safe, non-intrusive approach is taken. For 4.0 we are still in time to merge Modify Array/Dictionary::operator== to do real key/value comparison #35816 so that proper comparison is not a patch but an out-of-the-box feature.recursive_equal
todeep_equal
. I hope that makes sense to you and you are willing to adopt that name in your PR for 4.0. 😊Last word:
I've written the following GDScript snippet to test how well
deep_equal()
works and also to contrast it with==
:Fixes #29221.
This PR is generously donated by IMVU.