Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It just seems like a bad choice. The empty string being falsey is... very arbitrary to me. It seems like it's strictly a perl legacy thing that should be (but cannot be) reconsidered.

About as far as I am willing to go is nil punning.



FWIW - it has been reconsidered in Ruby - all values are truthy except nil and false.


> The empty string being falsey is... very arbitrary to me.

It's extremely useful in a lot of contexts. The basic logic is that an empty string is an empty container, and empty containers are false, so you can test for them more easily.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: