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

If the screwdriver is called hammer I would blame the manufacturer.

An int with the value 0 isn't empty.



What value would an empty int have, then?


If it's not nullable and not undefined it's not empty.

If an int with 0 is empty a string with a only white spaces is the same kind of empty.

I think empty mixes the computer meaning of empty with the linguistic meaning.


What is the computer meaning of "empty?"

I'll answer - there really isn't one. You could say "undefined" but we already have another word for that ("undefined") - an "empty" construct doesn't exist in any other programming language that I'm aware of. Back in PHP's way-too-helpful days, they came up with this concept, so they got to define what it meant. (And to be fair, as with other things from the bad old days, it has caused confusion ever since.)




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

Search: