[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DEFPROP and PUTPROP



    Date: 25 Jan 1979 2119-PST
    From: Guy Steele <GLS at SU-AI>

    Gee hiz.  Anyone who depends on the value of DEFPROP
    deserves to lose.  If we were really winning we would arrange
    for DEFPROP to return NO value (as in "MARVEL"!).

Sigh. I'm not sure if you are serious or not. Yes, it might be nice
if things like DEFPROP, etc. didn't return values but they do. I might
point out that the fact that they do is supposedly one of the big features
of Lisp. That you can make use of return values as in:

   (DEFUN PRINT-AND-RETURN-A-RANDOM-NUMBER ()
          (PRINT (RANDOM)))

rather than the fortran-ish style:

   (DEFUN PRINT-AND-RETURN-A-RANDOM-NUMBER ()        ; Yech
          ((LAMBDA (TEMP) (PRINT TEMP)) (RANDOM)))

or

   (DEFUN PRINT-AND-RETURN-A-RANDOM-NUMBER ()        ; Double-Yech
          (PROG (TEMP)
		(SETQ TEMP (RANDOM))
		(PRINT TEMP)
		(RETURN TEMP)))

You are saying I am foolish to rely on what it returns, but if you think
for a moment I hope you'll admit that I'm foolish only 'cuz I know better
about how the language was derived and maintained. Why shouldn't that be
perfectly well-defined? 

Most of these other things that assign values to things (and I use the
phrase 'assign values' loosely as in SETPLIST, RPLACA, SETQ, ... et al
as I mentioned in the note that started this) return the value of the thing
they set. Things that have a clearly defined, well-thought-out return-value
will make for much better compilation and generally nice program elegance.

Do you disagree? I think this is an important issue. I have received several
messages from people in the last year or so with the form "well, you're
foolish for relying on what <x> returns" and I would like to settle this.

-kmp