3 ms·
TLDR (at the end): "Certainly the CL approach carries more historical baggage." > Combining the empty list and the special false object can lead to particularl
by tuukkah 4y ago
TLDR (at the end): "Certainly the CL approach carries more historical baggage."
> Combining the empty list and the special false object can lead to particularly good implementations perhaps.
I suppose they wanted the null pointer to represent them both in RAM, because every CPU has an instruction to test whether a value is zero, or even a flag that is set for free when you encounter the value.
- lisper 4y agoThat's one reason. Another is that it allows you to use the idiom (if X ...) to test for non-null rather than (if (not (null X)) ...)
- tuukkah 4y agoIndeed, although some languages achieve the same by defining multiple falsy values, e.g. JS has 9 such values: https://developer.mozilla.org/en-US/docs/Glossary/Falsy https://developer.mozilla.org/en-US/docs/Glossary/Falsy
- lisper 4y agoYeah, but this causes its own set of problems when, for example, you are surprised that 0.0 is false but -0.0 is true. In general, punning of any kind is a Really Bad Idea when code gets complicated.