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


    Date: Wed, 19 Nov 86 23:41:56+0900
    From: Masayuki Ida <a37078%ccut.u-tokyo.junet%utokyo-relay.csnet at RELAY.CS.NET>
    To:   common-lisp at SU-AI.ARPA, ida%u-tokyo.junet at RELAY.CS.NET
    Re:   TYPE-OF

    D-Eval concept needs TYPE-OF.  kinds of type inferencing system
    will also need TYPE-OF to determine the type.
    Here is a conversation with D-Eval:

    D-Eval>(+ 1 2)
    ; FIXNUM

Well, if all D-Eval uses Type-Of for is to print out the type, then it
doesn't really matter what it returns.  I had in mind a fragment of
code that needed to use Type-Of.  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.

Suppose that I was examining the expression:
  (+ (aref a 3) 7)
Now, if A is known (due to declaration) to be 
(array (unsigned-byte 8)), then I could combine the fact that 7 is
(integer 7 7) with that information to determine that the result of the
addition is (integer 262 7), which is probably a useful thing to know.
If all that I know is that 7 is FIXNUM, then all bets are off.

I didn't mention this on the mailing list as a valid use of Type-Of,
  1] The compiler *is* the implementation, so it doesn't matter if it
     is implementiaton dependent.
  2] The version of Type-Of that I am using in the compiler is
     optimized to return what the compiler considers most interesting,
     rather than what the user might consider most informative.  For
     example, given a symbol, it returns (member <symbol>).