-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
No warning when getting built in Callable from Dictionary #87122
Comments
Note that the feature currently skips dictionaries for compatibility reasons. Both Problems:
|
First, a quick question about compatibility considerations. Although (https://github.com/godotengine/godot/pull/82264) has been merged, I wonder since it is only in a dev build whether the policy around compatibility breakage is less strict. I definitely agree that the behavior shouldn't depend on what keys are in the dictionary. Of the options you listed, I like 1.1 the best. The only other alternative I can think of is to emit a warning whenever "clear" is used as a key in a dictionary, but I'm not sure it's much better than 1.1. For problem 3. |
I looked at this issue. A suitable binder class is not implemented, it may be non-trivial to do as far as I remember. Also, I'm not sure whether the problem could be that the signature |
Hmm, what about changing the signature in cpp to take a |
Tested versions
4.3.dev [b042636]
System information
Godot v4.2.stable - Windows 10.0.22621 - GLES3 (Compatibility) - Intel(R) Iris(R) Xe Graphics (Intel Corporation; 31.0.101.4255) - 12th Gen Intel(R) Core(TM) i5-1235U (12 Threads)
Issue description
A GDScript feature was recently added (#82264) that allows methods of built-in Variant types to be accessed as Callables. For example the feature makes the following code work.
This is a great feature, except there are cases where it could lead to potential confusion.
There is also potnential for confusion when using type annotations. In the following code
the analyzer does not complain, but at runtime, I get "INTERNAL ERROR: Trying to assign value of type 'String' to a variable of type 'Callable'."
I'm not entirely sure what the best solution is, but as the title suggests, it might make sense to emit some kind of GDScript warning when the user creates or accesses a key that has the same name as a built in method.
Steps to reproduce
Run the script above.
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: