
. . .
The typical example in C is: mem = malloc(1024) Malloc returns 0 to indicate that memory cannot be allocated, or a memory address if it can. The variable mem is a so-called hybrid variable; it crunches together 2 different concepts: a boolean value (could I allocate memory?) and an address value (what is the address where I can find my allocated memory).
An infamous example would be the convention in Common Lisp that nil, the empty list, is also "false" for conditionals while anything else is "true" for conditionals. So the member function ('a * ['a] -> ['a]) can be used either as a predicate or a function returning a useful value.
It's considered a bad idea because it makes it easy for programmers to use the value inappropriately - witness the number of programmers who pass in 0 as a memory location. The suggested solution is to give each
And the Scheme community chose "#f" and "#t" for boolean values so you had to be a little more explicit about what you were doing. I mostly agree with the "tightening-up", but there are times when I really miss the nil hacks :-) -- Bill Wood bill.wood@acm.org