3 ms·
It's not a matter of avoiding empty(). It's a matter of only using it when it's the correct tool. The examples were examples of someone using a screwdriver when
by chiefalchemist 2y ago
It's not a matter of avoiding empty(). It's a matter of only using it when it's the correct tool. The examples were examples of someone using a screwdriver when they needed a hammer. That's not the screwdriver's fault.
- croes 2y agoIf the screwdriver is called hammer I would blame the manufacturer. An int with the value 0 isn't empty.
- Cyberdog 2y agoWhat value would an empty int have, then?
- croes 2y agoIf 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.
- Cyberdog 2y agoWhat 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.)