3 ms·
Something even easier to reason about: Only true is true, and only false is false!
by tialaramex 5y ago
Something even easier to reason about: Only true is true, and only false is false!
- eropple 5y agoI disagree - presence/absence allows reuse of clear and terse operators, reduces the need for an extra null coalescence operator when logical or can do the job as well, and enables better developer experience in places like options hashes where "not set" always means the same thing as "false".
- happytoexplain 5y agoI think modern languages have demonstrated that the dev UX difference between allowing "falsey"/"truthy" and not allowing it can be reduced to be quite small. Meanwhile, consider that the bugs introduced by implicitly considering things false/true are arguably a type of "bad dev UX".
- eropple 5y agoI can't think of a case, personally, where conflating false and nil/null/undefined has created a bug. I can think of many for, like, JS treating the empty string or zero as false, but not for specifically null/undefined. Can you provide an example?
- capableweb 5y agoYou're talking about hard true/false, in which you are correct. The person you're replying to is talking about "Truthy"/"Falsy", which is different than the hard true/false you're talking about.
- happytoexplain 5y agoI read the parent as, slightly sarcastically, saying "it's easiest to reason when the concept of truthy/falsy is completely absent".
- deleted 5y ago[deleted]