<HTML><BODY>Will you accept patch for this, if I'll write it?<br><br>(contract-out ...) will have (id debug-contract-expr production-contract-expr) instead of (id contract-expr) in syntax<br>There will be global phase-1 variable <br>contract-mode : (or/c 'nothing 'production 'pre 'pre-and-past 'all) = 'all<br><br>nothing -- no checks<br>production -- use production contract if present, otherwise check only pre-condiction<br>pre -- check only pre-condiction<br>pre-and-post -- check pre and post conditions<br>all -- current behavior<br><br><br><br><br>Tue, 3 Jun 2014 12:47:18 -0400 от Matthias Felleisen <matthias@ccs.neu.edu>:<br>
<blockquote style="margin: 10px; padding: 0px 0px 0px 10px; border-left-color: rgb(8, 87, 166); border-left-width: 1px; border-left-style: solid;">
<div>
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<base href="https://e.mail.ru/" target="_self">
<div id="style_14018140440000000723_BODY"><br>
Your mail calls for a philosophical answer. If this were Eiffel, you would be correct. <br>
<br>
But Racket is not Eiffel: <br>
-- we are not a tools company that sells a language <br>
-- we spent our own time on a maintenance effort that goes above and beyond our jobs <br>
-- and we don't provide a standard language (meant to make developers happy and its creators famous and wealthy). <br>
<br>
Racket is a programming language programming language [not a typo]. We wish to go beyond conventional features. When it comes to contracts, this means we wish to provide (1) higher-order contracts so that we cover the full spectrum of linguistic features and (2) a programmable toolbox so that programmers can create their own favorite idioms -- above and beyond the stuff available in standard languages. <br>
<br>
We fully understand that expanding the horizons of the language puts some burden on programmers. Every programmer may have to develop his own techniques and tools and idioms for our new features. We balance this burden with a catalog-driven on-line library, where programmers can register little more than a github URL to share such libraries. <br>
<br>
With apologies for the extra burden and the non-technical answer -- Matthias<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Jun 3, 2014, at 12:24 PM, Roman Klochkov <<a href="/compose?To=kalimehtar@mail.ru">kalimehtar@mail.ru</a>> wrote:<br>
<br>
> There should be _standard_ check-modes. With global variable (or better compile-mode).<br>
> <br>
> Because, I can in my own libraries make this 4 or even more modes. But I use 3d-party or standard library. And I cannot rewrite them all to my 4 modes. <br>
> Even if another developer will use the same idea, he or she will have own modes and own variable to set them.<br>
> <br>
> <br>
> Tue, 3 Jun 2014 07:47:37 -0400 от Matthias Felleisen <<a href="/compose?To=matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>>:<br>
> <br>
> You can program these scenarios with option contracts; see comparison in paper. Perhaps it's time to write this up as a chapter for the Guide. <br>
> <br>
> <br>
> On Jun 3, 2014, at 12:38 AM, Daniel Prager wrote:<br>
> <br>
>> > I propose something like two contracts: for debug and production modes.<br>
>> <br>
>> Eiffel compilers implement a sliding scale of contract-checking, something like:<br>
>> • Check nothing [naive]<br>
>> • Check pre-conditions only [good for production - quick]<br>
>> • Check pre- and post-conditions only [can be slow]<br>
>> • Check pre- and post-conditions and invariants [van be very slow]<br>
>> [Loop and ad hoc assertions would have been in there too.]<br>
>> <br>
>> Post-conditions and invariants can be *very* expensive to check, but are great when debugging.<br>
>> <br>
>> Pre-condition checking is typically cheap, and quickly tells you when trusted code is being called with bad arguments.<br>
>> <br>
>> Recommeneded development practice was to start with all contracts checked, and as one's code iterated towards trustworthiness turn down the checking-level (but leave pre-conduitions on) and enjoy the huge speed boost.<br>
>> <br>
>> There's value in being able to control checking on a per module basis, essentially doing deep checks on newer / less-tested / less-trusted parts of the system.<br>
>> <br>
>> How does the picture change with higher-order contracts and checking at module boundaries?<br>
>> <br>
>> Dan<br>
>> <br>
>> <br>
>> <br>
>> On Tue, Jun 3, 2014 at 6:20 AM, Roman Klochkov <<a href="/compose?To=kalimehtar@mail.ru">kalimehtar@mail.ru</a>> wrote:<br>
>> The problem is that, when debbugging, contract should be precise. For example, insert-in-sorted-queue may check that queue is orted before and after the function. <br>
>> But inserting the element is O(log n) and testing will be O(n).<br>
>> <br>
>> option contracts -- 1) unstable 2) should be turned off and on individually.<br>
>> <br>
>> For quick hack, I'll simply redefine contract-out and recompile all. But I propose something like two contracts: for debug and production modes. <br>
>> <br>
>> <br>
>> Mon, 2 Jun 2014 15:49:05 -0400 от Matthias Felleisen <<a href="/compose?To=matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>>:<br>
>> <br>
>> <br>
>> On Jun 2, 2014, at 3:42 PM, Roman Klochkov <<a href="/compose?To=kalimehtar@mail.ru">kalimehtar@mail.ru</a>> wrote:<br>
>> <br>
>> > Is there a way to disable all contract checks? <br>
>> > <br>
>> > Suppose, I debugged my program and sure that it is reliable. I disable debugging, but as I understand, contracts are still checked in every function.<br>
>> > But I want to maximize the performance of my program. Is there a way to do that or I have to manually hack racket/contract/base to do that?<br>
>> <br>
>> <br>
>> No. <br>
>> <br>
>> ;; --- <br>
>> <br>
>> Programmers who disable assertion checking as they are deploying software are like people who wear life vests on land when they learn about the theory of sailing and take them off as soon as they board the boat for practical exercises on the water. -- somebody famous <br>
>> <br>
>> ;; --- <br>
>> <br>
>> You will need to define a version of provide and/or contract-out that throws away contracts based on a switch. <br>
>> <br>
>> Or you check out option contracts and use those. <br>
>> <br>
>> -- Matthias<br>
>> <br>
>> <br>
>> <br>
>> -- <br>
>> Roman Klochkov<br>
>> <br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
>> <br>
>> <br>
>> <br>
>> <br>
>> -- <br>
>> Daniel Prager<br>
>> Agile/Lean Coaching, Software Development and Leadership<br>
>> Startup: <a href="http://www.youpatch.com" target="_blank">www.youpatch.com</a><br>
>> Twitter: @agilejitsu <br>
>> Blog: agile-jitsu.blogspot.com<br>
> <br>
> <br>
> <br>
> -- <br>
> Roman Klochkov<br>
<br>
</div>
<base href="https://e.mail.ru/" target="_self">
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Roman Klochkov<br></BODY></HTML>