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

Argument lists

    Date: Tue, 1 Jul 1986  12:00 EDT
    From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
        I still think the right thing to do is to make (type-of <function>)
        return a type signature for the function. ... I proposed this last
        week sometime, and I saw only minimal feedback (which was positive).
        Are there any good reasons why the type system isn't the right place
        to garner this information?
    Sorry I didn't jump on this when it was first proposed.  Too much mail
    went by in too short a time.
    I really dislike this way of doing it.  Several reasons: First, this is
    a very inconvenient interface.  We require the system to cons up a funny
    list that the user then has to parse. 

This is no harder than parsing a regular arglist; however, I see your
point.  My complaint is not that there oughtn't be a digested numeric
version of this functionality, (and the circulated proposal seems
fine,) but rather this: The need to make statements about function
types in terms of arglists is indicative of a shortcoming in the type
system of CL. The shortcoming is that you can't find out anything
about the type of a function object.

    Second, it requires the type of
    every argument to be available in explicit form; this may be too much to
    ask of many systems. 

Actually, the types of the arguments can always be t, e.g.,
   (function (t t &key t ) (values t t))

Which additionally hides the names of the variables.

    Third, TYPE-OF has a lot of leeway in what it
    returns for all other forms, and is the source of much confusion. 

Right. I think the leeway should be removed, so that it is no 
longer confusing. CLtL defines a powerful and elegant type system
for lisp. Things like type-of should be tools that programmers can use
rather than underspecified thorns in the side. 

    seen several portable packages try to use this and get screwed up
    because they expected STRING and got (SIMPLE-STRING 37) or something.  

This is the equality bug all over again on types. Subtypep is usually
the right comparison to use for types, not list equality. Typep is generally
too strong as well. 

    I would like to promote the idea that TYPE-OF is useful mostly as an
    interactive debugging interface, and if you ever see TYPE-OF in code it
    is probably an error.

This is the way I feel about arglist accessing functions! They should be
part of an interactive debugging interface, not part of applications code.
And if you see programs manipulating arglists or asking about them, it
is probably something better stated in terms of the type of the 
function involved.

...mike beckerle
Gold Hill Computers