Open nanoquack opened 1 year ago
The first behavior is not going to change, pretty certainly, it's pretty universal across different languages to allow this, as it is a major source of confusion and errors
The second part is because when checking equality of Array
it checks the type as well, this should be documented because it can be confusing
See:
I agree that many languages do it this way (especially more dynamically typed ones), and I didn't mean to imply the behaviour has to be changed, but I think as @AThousandShips proposed the behaviour for Array and Dictionary should be documented
Godot version
v4.1.stable.official [970459615]
System information
Windows 11 Pro, Version 22H2, Build 22621.1778 - v4.1.stable.official [9704596] - Vulkan (Forward +)
Issue description
It's not really a bug, but it is somehow counterintuitive: While two variables can have different types int and float, they are treated as equal by the comparison operator:
This gets especially interesting, if you add an int and a float to an array or a dictionary and compare them:
As you can see, the two arrays are not considered equal, and rightly so, but the two values are considered equal. Wouldn't it be much more logical if comparison of an int and a float always returns false?
Steps to reproduce
See above
Minimal reproduction project
N/A