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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Apr 17 20:48:50 EDT 2005

Given that CL implementations don't actually implement the checks in  
the same manner as mz's contracts, it's not clear that this comparison  
is actually fruitful, but I'm referring to contracts like this:

(module m mzscheme
   (require (lib "contract.ss"))
   (provide/contract [f (-> (number? number?) number?)])
   (define (f g)  ... g ...))

If you're interested in the technical details behind this, have a look  
at  
http://people.cs.uchicago.edu/~robby/pubs/papers/ho-contracts- 
icfp2002.pdf

Robby

On Apr 17, 2005, at 7:28 PM, jekwtw wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> You're right about the usual practice, but I think it's more a matter  
> of
> advantage being taken of a loophole than intent as such.  As I said in  
> an
> earlier response, the CL spec says unequivocally that contexts that  
> violate
> a type spec are erroneous; the loophole is that an implementation need  
> not
> detect the errors to be conforming.  As to the technical matter, after
> perusing the doc (MzLib, Chap. 13; DrScheme 209) I'm unsure as to what  
> you
> are referring to as "higher-order function contracts".  CL type specs  
> do
> support specification of function signatures.  After quickly reading  
> section
> 13.2, it appears to me that most of the "->" forms have analogues in  
> CL type
> specs, although I'll have to think about the "->r" forms.
>
> BTW, since the CL type system "seamlessly" (it says so right here in  
> the
> label :-) integrates CLOS, I believe type specs can be used with  
> methods,
> generic functions, and classes.
>
> Thanks, this is interesting,
>
>  -- Bill Wood
>     bill.wood at acm.org
>
> ----- Original Message -----
> From: "Robby Findler" <robby at cs.uchicago.edu>
> To: "jekwtw" <jeaniek7 at comcast.net>
> Cc: "Matthias Felleisen" <matthias at ccs.neu.edu>;
> <plt-scheme at list.cs.brown.edu>
> Sent: Sunday, April 17, 2005 5:45 PM
> Subject: Re: [plt-scheme] Is there a general overview of contracts
> somewhere?
>
>
>> At Sun, 17 Apr 2005 16:21:10 -0500, "jekwtw" wrote:
>>> Out of curiosity, could you (or someone) provide a brief
>>> compare-and-contrast between PLT's contracts and Common Lisp's type
>>> specifiers and (declare ...) forms?
>>
>> I'm not very familiar with Common Lisp's type specs, but from what I
>> can tell, there is a substantial philosophical difference in that CL's
>> specs are mostly used by the cmpiler to optimize the code generation
>> (and thus, might remove checks that would be performed at run-time),
>> whereas Mz's are designed to improve the robustness of the code, so  
>> are
>> always checked, never assumed.
>>
>> Also, on the technical front, I suspect that higher-order function
>> contracts are not supported by CL.
>>
>> Robby
>
>



Posted on the users mailing list.