I know you jest, but the reason why shell programming uses 0 for success is understandable: that way you can have distinct non-zero returns for different kinds of errors (and several Unix utilities do have them). Arguably, testing for non-zero is a more satisfying idiom than testing for "non-one".
Are you saying that the shell (or C or assembly) is a language closely tied to a system, e.g., a CPU, a kernel and utilities - a system that can produce various types of errors?
Whereas APL is not tied to such a system, other than mathematics?
The shell is closely tied to running commands and the exit code of commands make up the true/false values. "return 0" in the main function of a C program means "no error" which is interpreted as true by the shell. Different non-zero return values signal different command (program) specific error states.
Comments
Why do "modern programming languages" return 0 for true? APL returns 1.
I know you jest, but the reason why shell programming uses 0 for success is understandable: that way you can have distinct non-zero returns for different kinds of errors (and several Unix utilities do have them). Arguably, testing for non-zero is a more satisfying idiom than testing for "non-one".
Thanks.
Are you saying that the shell (or C or assembly) is a language closely tied to a system, e.g., a CPU, a kernel and utilities - a system that can produce various types of errors?
Whereas APL is not tied to such a system, other than mathematics?
The shell is closely tied to running commands and the exit code of commands make up the true/false values. "return 0" in the main function of a C program means "no error" which is interpreted as true by the shell. Different non-zero return values signal different command (program) specific error states.
"The shell is closely tied to running commands..."
s/commands/programs/
But yes, I agree.
To arrive at a return value, APL evaluates a mathematical operation, whereas the shell evaluates the result(s) of executing a file.