[plt-scheme] Questions about contracts

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Apr 16 21:04:43 EDT 2007

I think you're confusing an error (in PLT's contract system) with a  
systemic flaw (in Eiffel's contract system).

Also, your error isn't repeatable:

Welcome to DrScheme, version 369.9-svn13apr2007 [3m].
Language: (module ...).
 > (define fred (make-array '#(#f) 8 8))
 > (define freds-diagonal (make-shared-array fred (lambda (i) (list i  
i)) 8))
 >

My hunch is that Robby fixed this.

;; ---

If I misunderstand your point, please articulate it differently. --  
Matthias

P.S. In the mid-90s, someone in Edingburgh published a Tech Rpt on 60 
+ flaws in SML (1.0) type system. I still claim and say in public  
that SML is a type-safe language.



On Apr 16, 2007, at 7:16 PM, Chongkai Zhu wrote:

> Let's say the SVN  Revision 3591 of SRFI 63 (http://svn.plt- 
> scheme.org/view/trunk/collects/srfi/63/63.ss? 
> revision=3591&pathrev=5900).
>
> The contract of make-shared-array is:
>
>   (make-shared-array
>    (->r ((array array?)
>          (mapper (->* () (listof natural-number/c)
>                       ((listof natural-number/c)))))
>         indices (listof natural-number/c)
>         array?))
>
> which looks fine.
>
> But if you run it:
>
>> (define fred (make-array '#(#f) 8 8))
>> (define freds-diagonal
>    (make-shared-array fred (lambda (i) (list i i)) 8))
> . 6:5: top-level broke the contract
>  (->r ((array ...) (mapper ...)) indices ... ...)
> on make-shared-array; expected a procedure that accepts 0 arguments  
> and any number of arguments larger than 0, given: #<procedure>
>>
>
> Chongkai
>
> ----- Original Message ----- From: "Matthias Felleisen"  
> <matthias at ccs.neu.edu>
> To: "Chongkai Zhu" <czhu at cs.utah.edu>
> Cc: <plt-scheme at list.cs.brown.edu>
> Sent: Monday, April 16, 2007 5:06 PM
> Subject: Re: [plt-scheme] Questions about contracts
>
>
>> Can you provide an example? A statement like this is rather, eh,   
>> strange. -- Matthias
>>
>>
>>
>>
>> On Apr 16, 2007, at 7:01 PM, Chongkai Zhu wrote:
>>
>>>
>>> ----- Original Message ----- From: "Matthias Felleisen"  
>>> <matthias at ccs.neu.edu>
>>> To: "Henk Boom" <lunarc.lists at gmail.com>
>>> Cc: <plt-scheme at list.cs.brown.edu>
>>> Sent: Monday, April 16, 2007 4:55 PM
>>> Subject: Re: [plt-scheme] Questions about contracts
>>>
>>>
>>>>  (2) unlike Eiffel's, our contract system copes with higher- 
>>>> order functions.
>>>
>>> Sorry, but I tried our contract system with higher-order  
>>> functions recently, and doesn't feel that it works in general cases.
>>>
>>> Chongkai
>>>
>>>
>>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.