Re: [racket] Making a contract between a function and "the world in general" AGAIN

2012-11-26 Thread Ryan Culpepper
On 11/24/2012 09:13 PM, Harry Spier wrote: About a year ago, there was a discussion on the list about "provide" propagating existing contracts. (See: http://www.mail-archive.com/users@racket-lang.org/msg08623.html ) suggested by Neil Toronto for this reason: "...define/contract has a huge advant

[racket] Making a contract between a function and "the world in general" AGAIN

2012-11-24 Thread Harry Spier
About a year ago, there was a discussion on the list about "provide" propagating existing contracts. (See: http://www.mail-archive.com/users@racket-lang.org/msg08623.html ) suggested by Neil Toronto for this reason: "...define/contract has a huge advantage that contract-out doesn't have: it puts a

Re: [racket] Making a contract between a function and "the world in general"

2011-10-09 Thread Robby Findler
On Sun, Oct 9, 2011 at 11:42 AM, Carl Eastlund wrote: > On Sun, Oct 9, 2011 at 12:30 PM, Matthias Felleisen > wrote: >> >> On Oct 8, 2011, at 9:49 PM, Ryan Culpepper wrote: >> >>> But in your alternative, >>> >>>  (provide (contract-out [f contract-of-f])) >>> >>> the contract of f is *still* not

Re: [racket] Making a contract between a function and "the world in general"

2011-10-09 Thread Carl Eastlund
On Sun, Oct 9, 2011 at 12:30 PM, Matthias Felleisen wrote: > > On Oct 8, 2011, at 9:49 PM, Ryan Culpepper wrote: > >> But in your alternative, >> >>  (provide (contract-out [f contract-of-f])) >> >> the contract of f is *still* not manifest in the module. Instead of chasing >> down f, we have to

Re: [racket] Making a contract between a function and "the world in general"

2011-10-09 Thread Matthias Felleisen
On Oct 8, 2011, at 9:49 PM, Ryan Culpepper wrote: > But in your alternative, > > (provide (contract-out [f contract-of-f])) > > the contract of f is *still* not manifest in the module. Instead of chasing > down f, we have to chase down contract-of-f. We've also duplicated > code/knowledge (t

Re: [racket] Making a contract between a function and "the world in general"

2011-10-08 Thread Ryan Culpepper
On 10/08/2011 10:12 AM, Matthias Felleisen wrote: [...] (2) I object to provide-with-whatever-contract-you-already-have because I think programmers should explicitly state what they want (if they want something logical). We can already do this (define primes-to-primes (-> (listof prime?

Re: [racket] Making a contract between a function and "the world in general"

2011-10-08 Thread Matthias Felleisen
On Oct 8, 2011, at 12:48 PM, Neil Toronto wrote: > On 10/08/2011 10:12 AM, Matthias Felleisen wrote: >> >> (1) I do not understand Neil's problem. Say I have module A and >> want to protect its exports from abuses by clients, say module B, >> why do you use define/contract at all? The define/con

Re: [racket] Making a contract between a function and "the world in general"

2011-10-08 Thread Neil Toronto
On 10/08/2011 10:12 AM, Matthias Felleisen wrote: (1) I do not understand Neil's problem. Say I have module A and want to protect its exports from abuses by clients, say module B, why do you use define/contract at all? The define/contract form is for splitting modules into module-lets -- in case

Re: [racket] Making a contract between a function and "the world in general"

2011-10-08 Thread Matthias Felleisen
(1) I do not understand Neil's problem. Say I have module A and want to protect its exports from abuses by clients, say module B, why do you use define/contract at all? The define/contract form is for splitting modules into module-lets -- in case your module is too large and you can't manage inv

Re: [racket] Making a contract between a function and "the world in general"

2011-10-07 Thread Robby Findler
It would be good if we had a provide form that meant "provide it with the contract it already has" that you could use as a short-hand to avoid duplicating the contract (really: avoid giving the contracts names and managing those names since contracts are values). We have talked about that before,

[racket] Making a contract between a function and "the world in general"

2011-10-07 Thread Neil Toronto
Using define/contract or a contract region, we can make a function with a contract between the function and the module. If the function is provided and a requiring module applies bad arguments, the module gets blamed. Or we can use (provide (contract-out ...)) instead, and make a contract bet