<div dir="ltr"><div><div>Each existing properties can come with a batch of generic test to test some usual corner cases, to check that property holds.<br></div>It would indeed be easier if some elements of the domain/range could be given (or an automatic generator).<br>
</div><div>Random testing would be good, but I don't think it's necessary to impose this constraint to have good assurance that the operator is well defined.<br></div><div></div><div><br></div>Do you know why C++ has stopped pursuing this idea by any chance?<br>
<div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 5, 2013 at 6:58 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="im"><br><div><div>On May 5, 2013, at 12:51 PM, Laurent wrote:</div><br><blockquote type="cite">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 5, 2013 at 6:44 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
C++ has tried this tack for some time. </blockquote><div><br></div><div>Sounds like it has failed then.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I can see doing for built-ins but how would you go about programmer-created operations? Trust the programmer? -- Matthias<br>
</blockquote><div><br></div><div>Well, I guess some checks can be added, but I don't see the difference between attaching bad properties to a newly created operator and defining a buggy procedure.<br></div></div></div>
</div></blockquote></div><div><br></div><div><br></div></div>I think it is one thing to say <div><br></div><div> (define (fahrenheit->celsius f) 32)</div><div><br></div><div>and another to attach "associative" to the floating-point + operator. Since we all write examples first and translate then into test suites before we code, finding a bug in fahrenheit->celsius is straightforward and supported by our support mechanisms. If you don't trust your tests, attach contracts to your procedures because they generalize tests in a natural way. Finding bugs in false claims about functions is much less supported at the moment. Perhaps random testing or model checking or something like that may help along here. </div>
<span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Matthias</div><div><br><div><br></div></div></font></span></div></blockquote></div><br></div>