[racket-dev] Removing Xexpr preference from Web Server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sun Dec 5 01:29:50 EST 2010

Giving special consideration to Eli and YC's perspectives, I've come up with
the following way out of this problem.

I found a way to provide a global hook that is tasteful to me. I've created
"dynamic/c". Here's a little example:

Examples:
  (define p (make-parameter any/c))
  (define c (dynamic/c string? p number?))
  > (contract c "123" 'pos 'neg)
  pos broke the contract
    (dynamic
     string?
     #<procedure:parameter-procedure>
     number?)
   on eval:5:0; expected <number?>, given: "123"
  > (p (coerce/c string->number))
  > (contract c "123" 'pos 'neg)
  123
  > (contract c "123a" 'pos 'neg)
  pos broke the contract
    (dynamic
     string?
     #<procedure:parameter-procedure>
     number?)
   on eval:8:0; Coercion failed

The Web Server will define response/c as (dynamic/c any/c current-response/c
response?) and provide the current-response/c parameter for customization.
The default will be no coercion, but Xexpr conversion will be easily
accessible. A compatibility library will automatically set
current-response/c appropriately.

Attached is the new compatibility README.

I hope this will satisfy all.

Jay


-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20101204/4c61ae30/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: README
Type: application/octet-stream
Size: 3044 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20101204/4c61ae30/attachment.obj>

Posted on the dev mailing list.