[racket] Issue with require/typed and the json library

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Dec 6 10:37:50 EST 2014

On Dec 6, 2014, at 1:08 AM, Alexis King wrote:

>> It doesn’t have to be a struct, but the problem is that typed racket doesn’t know that a value of type String for instance will be of type JSExpr or not, so you would have to put (assert x jsexpr?) around everything that you want to treat as a jsexpr.
> 
> Ah, that’s interesting. I’d seen assert when digging through the docs, but I didn’t quite realize how it worked at the time. Looking back at it again, I’m surprised I missed it, but no matter.
> 
> That does solve the problem, albeit rather inelegantly. I’d be interested to see if there’s another way, but I would understand why it would be difficult to implement a cleaner approach.

From 100,000 ft: 

 JSON and XML and such things have one of two types: a coarse one that does not really address the things a programmer thinks and an incredibly fine-grained one that expresses all of these things. The latter requires a highly intrinsic, complicated, difficult to use thing [due to the union/recursive/dynamic nature of the objects], which no real languages comes with. I conjecture that TR could accommodate just such a type system -- but that might be a dissertation. I should talk to Sam. 

-- Matthias


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141206/adc63b23/attachment.html>

Posted on the users mailing list.