[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: RWK@YUKON.SCRC.Symbolics.COM
- Subject: Re: type-of
- From: masinter.pa@Xerox.COM
- Date: Tue, 18 Nov 1986 19:24:00 -0000
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: Robert W. Kerns <RWK@YUKON.SCRC.Symbolics.COM>'s message of Tue, 18 Nov 86 16:04 EST
Here's a proposed level of specificity for type-of and subtypep which
would be an improvement:
Let Z be the set of "well-behaved" type specifiers. (To be listed).
Then, for all Z:
For all data X:
if (typep x Z) => (subtypep (type-of x) z)
This says that type-of has to return something specific enough that
subtypep can deal with it.
My candidate set of "well-behaved" subtypes are exactly those that are
required to be distinct in Common Lisp:
array, number, integer, complex, float, symbol, ratio, rational...
This (a) isn't hard (b) is probably implemented by most common lisps
The exact set of types identified as "well-behaved" is debatable, but I
think it is wise to leave out any implementation dependent types,
(long-float vs short-float, fixnum vs bignum), all of the non-intrinsic
types (satisfies), or require the relation to be true of any types that
are hard to calculate (things like nested ands and ors).
There may be a more specific stringent specification of type-of and
subtypep that people want to adopt, but its hard to imagine something
*less* specific than this, yet this seems adequate for most of the
purposes I know of.