[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
#f, '(), and true radicalism.
I care more about truth and falsity than about the list termination
conventions. To me the question is how IF treats its predicate value.
As long as a predicate of '() and #f mean take the false branch, and
all other values mean take the true branch, there will be horrible
punning and accidentally unportable code.
The current draft of the standard states
Of all the standard Scheme values, only #f is guaranteed to count as
false in conditional expressions. It is not specified whether the
empty list counts as false or as true in conditional expressions.
Except for #f and possibly the empty list, all standard Scheme values,
including #t, pairs, ..., count as true.
Thus it is legal for an implementation to have '() count as true.
Thus portable code CANNOT use the pun.
I don't want '() to count as #f, unless they are the same object. I
just think that the decision of chosing a value to represent the empty
list should be orthogonal to the decision of chosing a value to
represent falsity, and they may very well be the same.
Perhaps people would be happier if the wording were modified to say
something like
"Only #f is considered to be false. In some implementations the empty
list may be the same object as #f, and thus in these implementations
'() will be considered false as well."
It seems silly (although I don't find it objectionable) to have
implementations where '() and #f are distinct yet they are both false.
This should certainly not be required.