4 ms·
We've had these exact same sorts of issues in PHP. It can go undetected for awhile and cause subtle bugs. A good type system helps a lot. I appreciate that Kotl
by brobdingnagians 5y ago
We've had these exact same sorts of issues in PHP. It can go undetected for awhile and cause subtle bugs. A good type system helps a lot. I appreciate that Kotlin is more stringent than Java with no implicit conversions between Int/Long/Float/Double.
- deergomoo 5y agoI once lost most of an afternoon debugging an issue where orders in a PHP e-commerce system would very occasionally fail. Turns out several months before, someone was doing some refactoring, moved some methods around, but also changed a "==" to a "===" in the process. Generally a good idea, but it slipped through to production without anyone noticing or breaking any tests. The issue ended up being that a rare code path in a tangentially related method would cause that method to return a float instead of an int. This propagated through, eventually causing a check of 0.0 === 0 to fail where previously 0.0 == 0 passed.
- irrational 5y agoThe problem here is == was used in the beginning. Always use ===.
- johnmaguire 5y agoUnfortunately "use X from the beginning" is rarely a solution when you're no longer at the beginning.