Subject: Re: I am new to Lisp and Dynamic Type Checking
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 11 Feb 2007 08:26:35 -0600
Newsgroups: comp.lang.lisp
Message-ID: <h5OdncnenK8GulLYnZ2dnUVZ_s6onZ2d@speakeasy.net>
Alan Crowe  <alan@cawtech.freeserve.co.uk> wrote:
+---------------
| ...but the usual idea is to declare types, and make type
| checking a matter of compilation policy. With CMUCL the
| interpreter just ignores the type information...
+---------------

But given that the OP is a newbie, one should point out that in
CMUCL (as with several other CLs), there is *both* a full compiler
and a (half-compiling) interpreter available to the user at all
times; interpreted code may call compiled code and vice-versa.

And while "the CMUCL interpreter just ignores the type information",
the CMUCL compiler very much does *not* ignore it, but treats it as
a promise by the programmer[1] that the types will be as declared --
which often allows *much* more efficient compiled code to be generated
but risks snot demons[2] if the programmer's promise is violated.


-Rob

[1] In ANSI Common Lisp, unlike most other languages, type declarations
    are not requests by the programmer asking the compiler to check
    the types, but rather are promises *by* the programmer *to* the
    compiler that the the declarations will be satisfied at runtime:
    
	http://alu.org/HyperSpec/Body/sec_3-3.html>.
	3.3 Declarations
	...
	The consequences are undefined if a program violates a
	declaration or a proclamation. 

[2] One of the possible outcomes of anything in Common Lisp for
    which the ANSI standard says "the consequences are undefined".
    It is frequently noted that such undefined behavior could range
    from "nothing" to "42" to "a core dump" to "snot demons flying
    out of your nose" to "starting a thermonuclear war".[3]

[3] Any similarity to the plot of the movie "Wargames" (1983)
    <http://en.wikipedia.org/wiki/WarGames> is purely coincidental.
    Really. (And if you believe that, I have this bridge...)

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607