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

Re: Issue: FUNCTION-TYPE-REST-LIST-ELEMENT, FUNCTION-DECLARATION issues



    Date: Thu, 3 Dec 87 11:57:05 MST
    From: sandra%orion@cs.utah.edu (Sandra J Loosemore)

    One reason for wanting to use a FUNCTION type specifier is that you may
    only be concerned with how many arguments a function can take, and you
    don't care at all about their types. ...

Thanks for remembering to mention this issue. It pops into my head from time to time
and then I always forget it before I get to the console.

Yes, the same style of issues as I raised in my last message applies to argument
number. eg, if I did

 (PROCLAIM '(FUNCTION FOO (NUMBER NUMBER) NUMBER))
 (DEFUN FOO (X Y) (+ X Y))
 
and later did:

 (LOCALLY (DECLARE (FUNCTION FOO (FIXNUM &REST (LIST T)) FIXNUM)) ... (FOO ...) ...)

would I be within reason? ie, is there semantic impact to the &REST which goes beyond
type declaring the rest of the arguments to be of type T? Am I also declaring that the
function was in fact compiled believing that a &REST style argument pickup was used
(and at the same point as I've specified it here). What about:

 (PROCLAIM '(FUNCTION FOO (NUMBER &REST (LIST NUMBER)) NUMBER))
 (DEFUN FOO (X &REST Y) (APPLY #'+ X Y))
 and then later
 (LOCALLY (DECLARE (FUNCTION FOO (NUMBER NUMBER &REST (LIST NUMBER)) NUMBER))
   ... (FOO ...at least two arguments...) ...)

In my CL conversion of Macsyma, I threw out all the *LEXPR declarations because
CL couldn't make any use of them and they were just clutter. (And they'd be trivial
to re-conjure if they were ever needed.) But I felt funny as I did it because I did
know I was throwing away information that would be interesting to some compilers
and that seemed sad, so I definitely agree that one way or another, this is a real
issue.