Re: [racket] Contracts and submodules

2013-03-05 Thread Matthias Felleisen
Similar mode here. My "list of things to improve my programming by programming" goes into a project folder called Lib/ . When I don't have time, I write down a design and GTD. When I have breathing space, I return and invest time in the 'todo' list. It almost always pays off soon after I invest

Re: [racket] Contracts and submodules

2013-03-05 Thread Greg Hendershott
Thank you for the "de-clutter" strategies. I realized I could do something of this sort. One of the things I love the most about Racket is the ability to do this. On the other hand sometimes that capability can be distracting for me. For example lately I've wanted to focus more on programming in R

Re: [racket] Contracts and submodules

2013-03-05 Thread Danny Yoo
> > One way to avoid this problem is instead of module+ use module*: > > (module* test racket ;; To test module-boundary contracts, must use >;; module* and (require (submod "..")). > (require (submod "..")) > ... check check check ... > ) Yup! A similar que

Re: [racket] Contracts and submodules

2013-03-05 Thread Matthias Felleisen
1. Clutter removal is built into Racket: (define-syntax (interface stx) (syntax-case stx (subject-to) [(interface name clauses ...) ;; ==> .. (provide (contract-out ..) ..) ..])) The above macro has become a standard in my recent projects where I place it into my ./Lib/contrac

Re: [racket] Contracts and submodules

2013-03-05 Thread Greg Hendershott
Not to flog this, but: Lately I've been trying to be a good little doobie and use `(provide (contract-out))` instead of `define/contract`. Although it's more typing/clutter, grumble grumble, I've been getting used to it. Unfortunately I discovered one gotcha: Using (module+ test ) means that the

Re: [racket] Contracts and submodules

2012-12-27 Thread Matthias Felleisen
I have added a note on this issue to the Style issue; see section 3.6. Strictly speaking, this prose probably belongs into the Contract guide. -- Matthias On Nov 30, 2012, at 5:17 PM, Ryan Culpepper wrote: > You can have mutually recursive functions with define/contract, but you can't > with

Re: [racket] Contracts and submodules

2012-11-30 Thread Ryan Culpepper
You can have mutually recursive functions with define/contract, but you can't with submodules. Ryan On 11/30/2012 05:04 PM, Ray Racine wrote: Why not make this explicit by deprecating define/contract and support this use case with a submodule. They lightweight enough and makes boundary demarc

Re: [racket] Contracts and submodules

2012-11-30 Thread Ray Racine
Why not make this explicit by deprecating define/contract and support this use case with a submodule. They lightweight enough and makes boundary demarcations consistent, explicit and simple. Module -> boundary. On Nov 30, 2012 12:05 PM, "Matthias Felleisen" wrote: > > On Nov 30, 2012, at 10:15

Re: [racket] Contracts and submodules

2012-11-30 Thread Harry Spier
One thing I would find very useful is a blog post giving an overview of where its more appropriate to use Racket without using contracts,or Racket using contracts or Typed Racket. Also an overview of the speed issues would be very useful.. For example I know there is a cost to contracts, but I'm

Re: [racket] Contracts and submodules

2012-11-30 Thread Matthias Felleisen
On Nov 30, 2012, at 10:15 AM, Greg Hendershott wrote: >> This is a complete misunderstanding. > > Sometimes I feel like a kid in the room while the adults are talking. > When it comes to contracts, I have to stipulate that most of you are > smarter than me and have thought about this longer than

Re: [racket] Contracts and submodules

2012-11-30 Thread Robby Findler
I think that we can do better in this case. The -> contract combinator can be specialized when it sees that there really is a function with the right type and it actually sees the function itself to insert the checks into. But I should point out that benchmarking programs like this one can be very

Re: [racket] Contracts and submodules

2012-11-30 Thread Greg Hendershott
> This is a complete misunderstanding. Sometimes I feel like a kid in the room while the adults are talking. When it comes to contracts, I have to stipulate that most of you are smarter than me and have thought about this longer than me. Having stipulated that, it seems unfortunate and surprising

Re: [racket] Contracts and submodules

2012-11-30 Thread Harry Spier
On Fri, Nov 30, 2012 at 9:33 AM, Matthias Felleisen wrote: > > On Nov 29, 2012, at 11:47 PM, Harry Spier wrote: > >> And then to enable/disable contracts you can use the method Mathias >> pointed out here. >> http://www.mail-archive.com/users@racket-lang.org/msg12281.html > > > Thanks for remindi

Re: [racket] Contracts and submodules

2012-11-30 Thread Matthias Felleisen
On Nov 29, 2012, at 10:29 PM, Greg Hendershott wrote: > AFIK these subtleties of contracts and modules arise with > `provide/contract' -- by saying that the function should only use a > contract outside the module (or submodule). > > But I prefer to use `define/contract'. For one thing, I think

Re: [racket] Contracts and submodules

2012-11-29 Thread Robby Findler
The main value of putting contracts on modules is, in my opinion, that you can pinpoint blame. So when I fire up DrRacket and click in some strange way and get a contract violation, it helps me pinpoint which module. I don't generally need to pinpoint things at the definition level inside a module

Re: [racket] Contracts and submodules

2012-11-29 Thread Robby Findler
Oh, of course. Sorry for the confusion. Robby On Thu, Nov 29, 2012 at 8:56 PM, Matthew Flatt wrote: > I don't see a bug. > > The body of a `module+' module sees all of the bindings of its > enclosing module, unless those bindings are shadowed. > For example, > > #lang racket > (define x 5) >

Re: [racket] Contracts and submodules

2012-11-29 Thread Greg Hendershott
AFIK these subtleties of contracts and modules arise with `provide/contract' -- by saying that the function should only use a contract outside the module (or submodule). But I prefer to use `define/contract'. For one thing, I think it's easier and more-maintainable to group the contract near/with

Re: [racket] Contracts and submodules

2012-11-29 Thread Matthew Flatt
I don't see a bug. The body of a `module+' module sees all of the bindings of its enclosing module, unless those bindings are shadowed. For example, #lang racket (define x 5) (module+ main x) would print 5 (even though `x' is not exported), but #lang racket (define x 5) (module+ main

Re: [racket] Contracts and submodules

2012-11-29 Thread Harry Spier
Thanks Robby, Do I need to submit a bug report. Harry On Thu, Nov 29, 2012 at 8:32 PM, Robby Findler wrote: > That looks like a bug to me. > > Robby > > On Thu, Nov 29, 2012 at 6:59 PM, Harry Spier > wrote: >> Dear list members, >> >> Case 1 below doesn't give a contract violation but case 2 d

Re: [racket] Contracts and submodules

2012-11-29 Thread Robby Findler
That looks like a bug to me. Robby On Thu, Nov 29, 2012 at 6:59 PM, Harry Spier wrote: > Dear list members, > > Case 1 below doesn't give a contract violation but case 2 does. Is > this desired behavour or is it a bug? > > In DrRacket > Case 1 > - > #lang racket > (provide (contract-out