Hi,
Well, it's been a while since doing any major surgery on the type
system, but Paul Dietz's tests threw up a nasty surprise:
(subtypep 'integer '(or fixnum bignum)) -> NIL, T
The attached patch fixes this, at the cost of yet again incrementally
extending the algorithms (I miss CLOS!). It bears reviewing, I think,
if only because I haven't thought about the way I've broken the way
I've broken the infinite recursion properly.
The issue: intersection of union-types and union of intersection-types
are both naturally implemented by distributing operations. The danger
is that if this distribution is done unconditionally, then we can
recurse without bound. I've somewhat arbitrarily broken the recursion
in the new union type method for intersection-types in this patch;
however, breaking it in another place might be worthwhile; I haven't
thought about how it ties in with the distribution done by
MAYBE-DISTRIBUTE-ONE-UNION.
One refactor that I am fairly certain would be worthwhile would be the
separation of a new type-class, NEGATION-TYPE, from the current
HAIRY-TYPE -- essentially all the hairy-type methods now test for
(and (consp specifier) (eq (car specifier 'not)))
so one may as well abstract this out.
Happy thinking,
Christophe
[ Paul: if you're following, it would be good to define a
subtypep.integer-or-ratio analogous to your current
subtypep.fixnum-or-bignum test, such that you test for the
equivalence of (OR INTEGER RATIO) with RATIONAL ]