Le jeudi 4 mai 2017 03:00:10 UTC+2, Daniel Prager a écrit :
> On the subject of turning down contracts for performance and then being 
> bitten, believe me, I hear you: my preference is to have the maximum checking 
> I can afford. But when I'm really writing stringent post-conditions (or 
> invariants) they can get *really* expensive, negatively impacting on user 
> experience, which takes us into the land of pragmatic trade-offs. 
> 
> If I don't have a way to turn them off I'm either not going to write them at 
> all or comment them out, and then regret not using them on smaller test 
> scenarios.

On this topic, I have sometimes written recursive functions with expensive 
contracts (when recursing down a list, a contract on the whole list will have a 
total cost of O(n²)).

Using (provide (contract-out …)) is of course the right solution for the final 
version, but during debugging, the extra checks at each recursion step can help 
pinpoint bugs more easily.

In these cases, instead of turning off the contract checks altogether, it would 
be nice to have a way to disable the define/contract and turn it into a 
contract-out, using a single parameter (perhaps a per-file syntax parameter?).

I'm not sure what would be the best syntax and implementation strategy for 
this, though.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to