From: Larry Hunter

Subject: type inference bug

Date: 1997-6-13 14:52


Hi folks,

This is fairly minor, but it was annoyingly difficult to track down. 

The empty type is a subtype of all types.  However, sometimes ACL seems not
to get this quite right in the cases of AND types which are empty.  For
example, the type spec (AND LIST NUMBER) is empty.  However, 

 USER(111): (subtypep '(and list number) 'cons)
 NIL
 T

shows that it is not a subtype of all types.  Worse, the type inference is
not consistent.  The problem originally showed up in a typedef that was
supposed to define collections of symbols:

 (deftype nominal (&rest vals)
   (if vals `(and symbol (member <vals)) at ,> 'symbol))

This was (incorrectly) applied to some numbers, and then tested against
various possible supertypes:

 USER(115): (subtypep '(nominal 1 2) 'number)
 T
 T
 USER(116): (subtypep '(nominal 1 2) 'list)
 NIL
 T

I at first thought both of the above forms should return NIL, since the type
has to be a symbol.  Perusing the ANSI spec, however, convinced me that
(NOMINAL 1 2) is equivalent to type NIL, which means that both of the above
should return T.  Either way, they should both return the same value.

Larry Hunter
<nlm.nih.gov at hunter>