godot-docs
godot-docs copied to clipboard
Misleading description for Callable ==
I'm not actually sure how to improve the description because the behaviour of bound callables is so confusing; thus I'm opening an issue instead of a PR so that more qualified people can share their input.
Godot version: 4.5 and below
Issue description:
The documentation of the == operator for Callable mentions that true is returned if the compared callable invokes the same target - that is, however, not exactly true. The current behavior is the following:
print.bind("apple") == print; // false, as expected
print.bind("apple") == print.bind("apple"); // true, for the wrong reasons
print.bind("apple") == print.bind("tomato"); // true as well
print.bind("apple") == print.bind("tomato", "apple"); false
When comparing callables, the amount of bound arguments is compared, not what they actually are. The documentation should inform of this behavior, but I'm not exactly sure how to explain this in a concise manner.
URL to the documentation page:
https://docs.godotengine.org/en/stable/classes/class_callable.html#class-callable-operator-eq-callable