[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sad historical sidelights: Return values -- NIL vs undefined
- To: Fahlman @ CMU-CS-C
- Subject: Sad historical sidelights: Return values -- NIL vs undefined
- From: Kent M Pitman <KMP @ MIT-MC>
- Date: Mon, 02 Jan 1984 16:42:00 -0000
- Cc: Common-Lisp @ SU-AI
- In-reply-to: Msg of Mon 2 Jan 1984 12:02 EST from Scott E. Fahlman <Fahlman at CMU-CS-C.ARPA>
- References: Msg of 30 Dec 83 17:45-EST from "David A. Moon" <Moon%SCRC-TENEX at MIT-MC.ARPA>
Date: Mon, 2 Jan 1984 12:02 EST
From: Scott E. Fahlman <Fahlman at CMU-CS-C.ARPA>
... If Guy really intends this phrase to be taken seriously, which implies
special-casing every stream operation to handle this case, then some more
motivation and discussion is needed. In the absence of such, we are
treating this as an error...
Looking at people's code over the years, I've noticed (as I'm sure others
have) it's generally much better to leave undefined values explicitly
undefined rather than to say NIL is returned. Not only does it cause the
compiler to do extra work and produce shoddier code, but I have actually
seen people write things like:
(AND (PRED1 X)
(NOT (TERPRI))
(PRINC FOO)
(PRED2 X))
I've seen real Maclisp code that did this sort of silliness. Whenever you
needlessly define return values for things, you just set yourself up for
bitching from people who've taught themselves to depend on things they
should never have even considered using in the first place.
In general, I would say the return value of no function, operation, or
whatever should be defined unless we are prepared to be happy with people
picking up and using that value shamelessly.