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

TYPE-OF



    Date: Friday, 21 November 1986  15:58-EST
    From: Robert W. Kerns <RWK at YUKON.SCRC.Symbolics.COM>
    To:   Rob MacLachlan <RAM>

        Date: Fri, 21 Nov 1986  09:36 EST
        From: Rob MacLachlan <RAM@C.CS.CMU.EDU>

        ... I don't know exactly what you mean
        by a "type inferencer", but for the kinds of type inferences that I
        could conceive of a Lisp compiler wanting to do, you definitely want
        the *most specific* type, and certainly don't want to return random
        things such as FIXNUM which represent implementation details rather
        than language semantics.
    Eh?  You're contradicting yourself.
Nope, (INTEGER 3 3) is more specific than FIXNUM, which is after all
just (INTEGER most-negative-fixnum most-positive-fixnum).

    Compilers deal directly with implementation, and that's
    why you want something more specific, such as FIXNUM,
    rather than something at the level of language semantics,
    such as INTEGER.  I think you're trying to argue that you
    want something more specific still, but that's not TYPE-OF's
    job.
What we are trying to determine is what TYPE-OF's jobs is.  I
introduced my compiler example, not necessarily because I thought that
TYPE-OF should do what my CTYPE-OF does, but because I wanted to
challenge Ida's contention that TYPE-OF was useful for type inference.
I.e. I am still trying to home in on a valid use for TYPE-OF.  The way
that type inference is done by my compiler is irrelevant; I simply
wanted to show that Ida's TYPE-OF is useless in my type inferencer.

    In a recent message, I oversimplified TYPEP, [...]
    This mostly works.  However, this depends on TYPE-OF
    returning the most-specific type, so for any appropriate
    type for an object, TYPE-OF will return something at
    least as specific, and which SUBTYPEP can decide on.
    Let me assert at this point, without proof, that there
    is no such single type.

    The problem is that TYPE-OF is inherently an information-losing
    operation. [...]

I think we are agreeing violently.  My main disagreement with you is
over whether there is a way to make TYPE-OF as strongly defined as you
want without pointlessly constraining the implementation, and if so
whether it is worth the bother (and core).  People have written a
number of programs without a well-defined TYPE-OF/SUBTYPEP.  It is not
clear we should foist additional overhead on Common Lisp just to make
the semantics of a nearly useless operation esthetically appealing.

  Rob