All dynamic/c does is apply three contracts in a particular order where one is dynamic.<div><br></div><div>coerce/c strongly implies that the function is coercion, but its implementation is similar to how the contract system must already use projection functions (ie it cannot confirm that are actually projections; it just applies them and uses the result)</div>
<div><br></div><div>The default value of current-response/c is a projection (any/c)</div><div><br></div><div>The compatibility library does not provide anything with the /c suffix that is a coercion --- it gives normalize-response and automatically sets current-response/c, but doesn't give anything that implies it is a "contract"</div>
<div><br></div><div>Thus, the only thing that IMHO should irk you is xexpr-response/c that has the /c suffix and uses coerce/c with an actual coercion. Is that the case? What do you want me to call it?</div><div><br></div>
<div>Jay<br><br><div class="gmail_quote">On Sun, Dec 5, 2010 at 6:46 AM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You've made a contract that isn't a projection, but does a coercion?<br>
<br>
I'd be happier if you instead made your own separate wrappers and<br>
didn't use "/c" and didn't call this a contract.<br>
<font color="#888888"><br>
Robby<br>
</font><div><div></div><div class="h5"><br>
On Sun, Dec 5, 2010 at 12:29 AM, Jay McCarthy <<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>> wrote:<br>
> Giving special consideration to Eli and YC's perspectives, I've come up with<br>
> the following way out of this problem.<br>
> I found a way to provide a global hook that is tasteful to me. I've created<br>
> "dynamic/c". Here's a little example:<br>
> Examples:<br>
> (define p (make-parameter any/c))<br>
> (define c (dynamic/c string? p number?))<br>
> > (contract c "123" 'pos 'neg)<br>
> pos broke the contract<br>
> (dynamic<br>
> string?<br>
> #<procedure:parameter-procedure><br>
> number?)<br>
> on eval:5:0; expected <number?>, given: "123"<br>
> > (p (coerce/c string->number))<br>
> > (contract c "123" 'pos 'neg)<br>
> 123<br>
> > (contract c "123a" 'pos 'neg)<br>
> pos broke the contract<br>
> (dynamic<br>
> string?<br>
> #<procedure:parameter-procedure><br>
> number?)<br>
> on eval:8:0; Coercion failed<br>
> The Web Server will define response/c as (dynamic/c any/c current-response/c<br>
> response?) and provide the current-response/c parameter for customization.<br>
> The default will be no coercion, but Xexpr conversion will be easily<br>
> accessible. A compatibility library will automatically set<br>
> current-response/c appropriately.<br>
> Attached is the new compatibility README.<br>
> I hope this will satisfy all.<br>
> Jay<br>
><br>
> --<br>
> Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
> Assistant Professor / Brigham Young University<br>
> <a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
><br>
> "The glory of God is Intelligence" - D&C 93<br>
><br>
</div></div><div><div></div><div class="h5">> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://lists.racket-lang.org/listinfo/dev" target="_blank">http://lists.racket-lang.org/listinfo/dev</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>
</div>