Anonymous user
Null object: Difference between revisions
→Beginnings of Null Object: Spelling, grammar, mandatory link to Wikipedia. :)
(→{{header|Common Lisp}}: Rewrite. Also, no discussion of unbound variables since the task description explicitly says it's not about this issue.) |
(→Beginnings of Null Object: Spelling, grammar, mandatory link to Wikipedia. :)) |
||
Line 180:
The idea of making functions accept <code>nil</code> without failing did not appear in early Lisps. For instance <code>(car nil)</code> was erroneous: it was incorrect to try to access the first element of a non-list.
The defaulting behavior <code>(car nil)</code> which Common Lisp programmers take for granted was introduced in InterLisp, and then copied into MacLisp. (InterLisp had other liberties that do not survive
This <code>(car nil) -> nil</code> behavior shows <code>nil</code> in an kind of new role: the role of a null object which takes methods that apply to other objects and provides some default non-failing behavior. It is the beginnings of the
====Object-Oriented Null Object====
|