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

function specs



Let me try to reconstruct the history of functions specs (or their lack)
in Common Lisp.

1. The Symbolics folks at one point noticed the lack of function specs and
proposed adding a rather complex, fully extensible set of machinery for
function specs.

2. There was a bit of confusion surrounding the whole thing -- several
other complicated things, such as support for a flavor system, were
being discussed at the same time and seemed to interact with this
proposal.  The proposal was also wrapped in some unfortunate terminology
about function specs being the "name" of a function.  That further
confused the issue.  This way of looking at it seemed natural to Moon
et. al. but very unnatural to some of the rest of us.  Anyway, the
terminology was separable from the mechanics of the function spec
proposal, but some of us didn't realize this in time.  The result was
that a number of us of us (including me) boggled at the apparent
complexity of what was being proposed and began looking for a less
complicated way of accomplishing the same end.

3. I came up with the idea of using any SETF-able form in the "name"
slot of DEFUN as the place to put the resulting lambda or compiled
function.  (A symbol in that position would be special, in that the
function goes in the FUNCTION cell rather than the VALUE cell.)  It
seemed to me that this had the advantage of not requiring a whole new
set of machinery for defining these pseudo-names.  However, my proposal
had some bugs as well.

4. Both proposals attracted considerable support.  We decided to leave
the issue unresolved for the moment and think about it, rather than to
arbitrarily grab one solution or the other.  In the meantime, the
solution of making up a name (or having a macro do it as you illustrated)
seemed an entirely workable, if ugly, solution.

5. In the recent rush to wrap up the remaining loose ends so that Guy
could get the manual out, I indicated to Moon that I was ready to accept
a slightly simplified version of his proposal if he wanted to try again,
but we both agreed that reopening this issue would probably lead to
a lot of debate.  We decided not to try to resolve this issue for the
first edition of the manual, but to discuss it again after the first
edition is out.

So that's why Common Lisp does not currently include function specs.  An
implementation is allowed to add some sort of function spec as an
extension.  My guess is that when we all recover from the recent manual
debate and the ensuing damage control, function specs will be one of the
first items on the agenda.  If we can all agree this time (and I am
optimistic that we will), then these will go into all implementations
sometime soon as an advertised extension, and will become "official"
when the second edition of the manual comes out.

Isn't politics fun?

-- Scott