Re:PHP in 2022
by marcosdumay on Tuesday January 11, 2022 @09:28AM
(#29891776)
If you only know "don't use ==, use ===", you will just fall for the next unityped trap. If you know why you shouldn't use `==`, you know enough so that even if you don't go for `===`, using `==` safely is the least of your problems.
[ Parent
| on HN ]
Re:PHP in 2022
by The_Colonel on Tuesday January 11, 2022 @09:51AM
(#29892043)
> for the next unityped trap
Many languages are unityped and carry the same problems, yet they are hyped rather than bashed (e.g. Python, Ruby).
> If you know why you shouldn't use `==`, you know enough so that even if you don't go for `===`, using `==` safely is the least of your problems.
You have some weird false dichotomy going on. I'm personally in the state "I remember why == is bad (type coercion ...)" but I don't remember all the details to be able to use == correctly. I bet many people are in a similar situation.
Re:PHP in 2022
by marcosdumay on Tuesday January 11, 2022 @12:04PM
(#29894188)
Your two examples are not unityped, and most unityped languages are unityped all the way down and as a consequence do not have the same problems.