[plt-scheme] Is there a general overview of contracts somewhere?

From: Alexander Schmolck (a.schmolck at gmx.net)
Date: Tue Apr 19 16:03:24 EDT 2005

Matthias Felleisen <matthias at ccs.neu.edu> writes:

>> Yes, it's pretty clear that CL implementors typically *use* type specs as
>> pragmas for efficiency; however, the standard *does* say that contexts that
>> violate type specs are absolutely in error, but conforming implementations
>> are not *required* to detect the errors.  Thus there could be high-quality
>> implementations in which type specs are taken seriously.
>
> Do you know of one? -- Matthias

How about sbcl?
  
  <http://sbcl-internals.cliki.net/Declarations%20are%20Assertions>

Cmucl will also issue compile time warnings in situations like this:

    (defun f (x)
      (declare (type (mod 10) x))
        (+ x 1))
    (defun g (a)
      (declare (type (mod 10) a))
      (f (+ 12 a)))

gives

; Warning: Result is a (INTEGER 12 21), not a (VALUES &OPTIONAL (MOD 10) &REST T).

'as



Posted on the users mailing list.