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

Type Specifier: (OR (FUNCTION ...) ...)



Regarding your proposal that we allow forms like the following

    (or (function (list) list)
        (function (vector) vector))

as a way of specifying that the output type of a function matches its
input type...

It seems to me that there are a lot of things one might want to tell a
compiler about the type relationships between the arguments to a
function and its values.  For example, + performed on a positive fixnum
and a negative one is sure to return a fixnum, so no bignum check is
required.  Your proposal seems to take one small step in the direction
of such a declarative language, and then it stops.  If it were clear
that the extra cases your mechanism handles are the most common and
important ones, then I'd favor adding this special case, but it isn't
clear to me.  Also, it gets into all the issues raised by the
Commonloops type-precedence stuff.  If someone were to say

(or (function (list sequence) foo)
    (function (sequence list) bar))

then what do we do?  Once the object-oriented stuff settles a bit, maybe
the answer will be clear.

-- Scott