From: Marco A. <ma...@cs...> - 2004-09-28 14:23:51
|
On Sep 28, 2004, at 10:03 AM, Paul F. Dietz wrote: > Marco Antoniotti wrote: >> On Sep 27, 2004, at 10:31 PM, Paul F. Dietz wrote: >>> Marco Antoniotti wrote: >>> >>>> The above should always generate an error as (VECTOR NIL) is not a >>>> valid type specifier. >>> >>> >>> It's not? :) >> I took it back yesterday, but I have been having nightmares about it >> tonight (I should get a life, shouldn't I ? :) ) >> I checked with LW (which I find usually very good at compliance) and >> it gives an error. >> The reasoning why (ARRAY NIL) , hence (VECTOR NIL) should not be >> valid type specifiers is because they would violate the disjointness >> requirement on the array type hierarchy. Since NIL is the bottom of >> the type hierarchy, all disjointness requirements break down there. >> I.e. >> REAL----+------- FLOAT--------------+--------NIL >> +------- RATIONAL--------+ >> where I depicted the "disjoint" relation, which is fine. >> However, for compound types (I know there are tons of Ph.D. theses on >> the subject: I am not an expert) if we allowed (ARRAY NIL) to be a >> valid type specifier, then we should allow the following >> ARRAY -----+---- (ARRAY CHARACTER) ------+---- (ARRAY NIL) -------- >> NIL >> +---- (ARRAY T) ------------------------+ >> which would be incorrect as we would "rejoin" the ARRAY hierarchy >> above NIL, while this is expressively forbidden in the ARRAY and >> VECTOR definitions (CLHS 15.2: System Class ARRAY and System Class >> VECTOR.) >> Since the CLHS is weak on typing issues, and I do not recall any >> place where (ARRAY NIL) is explicitly forbidden, I would say that >> disallowing it is ok and it is a fair work around the CLHS >> incompleteness (or inconsistencies :) ) >> Please correct me if you think this is bogus. > > > I think this is bogus. :) > > I think you are imagining that if T1 is a subtype of T2, then (array > T1) > must be a subtype of (array T2). That's not the case. You are right. My bogosity score just went up :) However, then I do not understand why in SBCL you need the (OR (VECTOR NIL) (VECTOR CHARACTER)) thingy when dealing with STRING. Cheers -- Marco Antoniotti http://bioinformatics.nyu.edu NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488 715 Broadway 10th FL fax. +1 - 212 - 998 3484 New York, NY, 10003, U.S.A. |