News for hackers. Stuff that matters.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by dagw on Sunday September 04, 2016 @05:33PM (#12426826)
It doesn't have to be at the language level. It's not unreasonable to assume that someone, somewhere in the mists of time decided that the string "NULL" was a reasonable choice for representing missing data in some input data and things kind of snowballed from there.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by gtf21 on Sunday September 04, 2016 @05:38PM (#12426851)
I've seen this in code I've reviewed before, where people will check for `== "empty"` instead of just using types like `null` which were designed for this (in javascript).
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by kqr on Monday September 05, 2016 @01:04AM (#12428224)
A practise that may come from some shell scripting languages where `[ $x == "" ]` is an invalid command because empty strings aren't strings.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by _kst_ on Monday September 05, 2016 @04:24AM (#12428893)
That may be true in older shells, but in modern shells [ $x == "" ] is valid, and "" is a single token whose value is the empty string. But I've seen old code that does things like

    if [ x$x == "x" ] ; then ...
apparently because it was necessary at one time.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by kqr on Saturday September 17, 2016 @02:23PM (#12521692)
It depends on what you mean by "older" shells. More modern shells tend to support this properly, but the baseline for most shell scripts is /bin/sh which is not guaranteed to be modern – it is often a new release of Sh.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by astrodust on Monday September 05, 2016 @07:32AM (#12429548)
Anyone who's done even a trivial amount of programming in the shell knows to do: [ "$x" == "" ]
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by kqr on Saturday September 17, 2016 @02:24PM (#12521697)
That does not help, as far as POSIX is concerned.

    $ [ "$x" == "" ]
    sh: 2: [: unexpected operator