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

Re: Arg count checking



    Date: 1 Apr 85 01:00 PST
    From: masinter.pa@XEROX.ARPA

    All of these are instances where the CALLER knows the args are optional.

    I can imagine (not very seriously) a separate syntax for that, e.g., put
    the &OPTIONAL on the caller rather than the callee:

    (FOO 1 2 &OPTIONAL T) which says to call FOO with 2 arguments, and throw
    away the third if FOO only takes two arguments, but otherwise pass it
    all three.
I have needed this some number of times; it has been discussed locally
around here some, but to no end. 

Specifically, I had a function "A" with a functional argument.  A's contract
includes not only its own argument list, but the set of arguments with which
it calls its functional argument.   Some callees are not interested in 
all of the things that A passes them.  The callees can &REST IGNORE
the uninteresting arguments, or declare the arguments and ignore them.

I (and not many others) see a true lack of symmetry with ordinary
optional arguments.  The whole reason &OPTIONAL exists is so that a
caller need not have or show knowledge of arguments in which he is not
interested: not have dummy variables, or have to give their name or
number.  Every such argument[English,not Lisp] can be applied equally
well to the functional callees of functions accepting functional
arguments.