I'm wondering what the arguments for/against Falsy values are. On what principles would you decide to add or exclude them from a language? Are there any problems you could see them causing off-hand?
For users of languages that support Falsy values:
- Where specifically have you used them to your advantage?
- Where have you had unpleasant run-ins with them?
- Are there any rules or finer points in your language/project/team about where it's appropriate or inappropriate to use them?
For users of other languages:
- Have you ever seen a situation where you've thought "I wish I could use a Falsy value here"?
I'm tagging the question haskell
and python
because AFAIK those two represent opposite ends of the spectrum (Haskell demanding Bool
s when you use if
, and Python treating None
and some "empty" values as Falsy), but feel free to talk about your experience from other languages. Just mention where on the spectrum they stand.
Number(0) == true
the way you can in JS. (At least, not as a language feature.)