<div dir="ltr">Possibly related: the last time I checked, there was no widely adopted schema system for JSON, which is completely appalling. That is, it’s not possible to document an HTTP call as “returning a JSON object with field “timestamp” which is an integer and “value” which is a string and no other fields thank you very much” except by writing the english text. My impression is that in the great XML -> JSON switchover, schemas were the baby that was thrown out with the bathwater.<br><br>John Clements<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 6, 2014 at 7:37 AM, 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><div class="h5"><br><div><div>On Dec 6, 2014, at 1:08 AM, Alexis King wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><blockquote type="cite"><div style="word-wrap:break-word"><div>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.</div></div></blockquote></div><br><div>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.</div><div><br></div><div>That <i>does</i> 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.</div></div></blockquote><br></div></div></div><div>From 100,000 ft: </div><div><br></div><div> 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. </div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Matthias</div><div><br></div><br></font></span></div><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></blockquote></div><br></div>