|
From: Christophe R. <cs...@ca...> - 2002-01-21 20:06:00
|
On Mon, Jan 21, 2002 at 01:40:25PM -0600, William Harold Newman wrote: > Back in October (predating the death of my old laptop mail machine, > so this isn't a proper reply-to-ish reply to the original message) > Christophe Rhodes sent "a rough patch to fix bug 106". > > I'm going to reject it because it seems to be wrong in some details. > In particular, after the patch we have > * (sb-kernel:specifier-type '(complex (member 6 9))) > #<SB-KERNEL:NUMERIC-TYPE (COMPLEX RATIONAL)> > so that > * (typep (complex 1/2 3/2) '(complex (member 6 9))) > T > That seems worse than the old behavior, where the pre-ANSI code > refused to accept (COMPLEX (MEMBER ...)) types at all. I'd rather have > code that signals an error about its nonconformance than code which > quietly gets the wrong answer. I'm sure that you're right, but I don't see immediately what's wrong with these -- at least, if I believe sbcl-0.6.13's UPGRADED-COMPLEX-PART-TYPE. From the CLHS: (complex type-specifier) refers to all complexes that can result from giving numbers of type type-specifier to the function complex, plus all other complexes of the same specialized representation. So this type refers to the union of types of (complex 6 6), (complex 6 9), (complex 9 6) and (complex 9 9), and all other complexes of the same specialized representation. As far as I can tell from the sbcl sources, that specialized representation is (complex rational); upgraded-complex-part-type agrees: * (upgraded-complex-part-type '(integer 6 6)) RATIONAL * (upgraded-complex-part-type 'fixnum) RATIONAL So, (typep (complex 1/2 3/2) '(complex (member 6 9))) should indeed give T, by my reading. Am I wrong? Christophe PS: Note that it's entirely possible that I am either missing something blindingly obvious or that there is something else wrong with the patch (apart from the NULL/NIL confusion which I hope you remember about...) -- Jesus College, Cambridge, CB5 8BL +44 1223 510 299 http://www-jcsu.jesus.cam.ac.uk/~csr21/ (defun pling-dollar (str schar arg) (first (last +))) (make-dispatch-macro-character #\! t) (set-dispatch-macro-character #\! #\$ #'pling-dollar) |