[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Arguments and values to get.
Date: Thu, 19 Sep 1985 21:19 EDT
From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
To: Gregor.pa@XEROX.ARPA
In-reply-to: Msg of 19 Sep 1985 19:39-EDT from Gregor.pa at Xerox.ARPA
Why does Common-Lisp GET take a default-value argument instead of
returning a second value indicating whether the property actually
exists?
The default argument is useful in some cases, but admittedly is a bit
inelegant -- if you want to know for sure whether a value was found, you
have to be careful to choose some default argument that couldn't
possibly be stored in any property list. The reasoning (If I recall it
correctly) was that this occasional creation of a unique default is less
hassle than having to write an ugly multiple-value-bind every time we
want to return a default value in the property-not-found case. I'm not
sure I believe that any more.
-- Scott
It would be reasonable to propose a more-or-less upward-compatible extension
to GET (for CL86 or whatever) which provided that GET both accepted a argument
specifying the default to be used -and- returned two values (one the result,
the second a boolean saying whether the argument had been defaulted).