Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!hookup!swrinde!pipex!uknet!festival!edcogsci!jeff
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Subject: Re: DEFTYPE/TYPECASE interaction
Message-ID: <Cyx2EA.7sF@cogsci.ed.ac.uk>
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: bute-alter.aiai.ed.ac.uk
Organization: AIAI, University of Edinburgh, Scotland
References: <FXaBVc3w165w@sytex.com> <39glv8$869@cantaloupe.srv.cs.cmu.edu>
Date: Mon, 7 Nov 1994 21:30:10 GMT
Lines: 24

In article <39glv8$869@cantaloupe.srv.cs.cmu.edu> ram@cs.cmu.edu (Rob MacLachlan) writes:

>One persistent problem in CMU CL has been that many implementations don't
>consistenly check type declarations.  For example, in CLX (the X interface), a
>macro INDEX- was defined which expanded:
>    (index- a b)
> ==>
>    (the (unsigned-byte 29)
>	 (- (the (unsigned-byte 29) a)
>	    (the (unsigned-byte 29) b)))
>
>At some point in the code, someone then said something like:
>    (let ((xx (index- xx)))
>      (if (> xx some-non-negative-number)
>	  ...))
>
>Now, obviously the only valid argument to one-arg INDEX- is 0, and the result
>is always 0, thus is never greater than any other non-negative number.  The
>reasoning is prefectly correct, but unfortunately, the program is incorrect,

Why is the program incorrect?



