3 ms·
- XML and HTML are good ways to structure data...sometimes. Other times, they're godawful. Especially if you're trying to pass data from one piece of code to an
by ender7 15y ago
- XML and HTML are good ways to structure data...sometimes. Other times, they're godawful. Especially if you're trying to pass data from one piece of code to another piece of code in order to do RPC-like things (server->client, for example). There's a reason that JSON is popular, and it's not because "it's the cool thing to do".
- JSON is a strict subset of Javascript syntax. You can always eval() a JSON string to convert it (not that you should). Many browsers support native JSON parsing now, so it's also very fast. I'm not sure what the downside is there.
- MostAwesomeDude 15y agohttp://timelessrepo.com/json-isnt-a-javascript-subset http://timelessrepo.com/json-isnt-a-javascript-subset JSON isn't a strict subset of JS. Moreover, no, you should never eval() things which are untrusted. Do you really trust everything the browser tells you? No? Then why trust JSON? I'm not anti-JSON, I'm anti-JS. Browsers don't support other languages (except for VB, which bites, and Fx nightly support for Python, which I wish would become more widespread) so there's no choice in a browser. On the server side, though, you have a chance to use real languages, so you really should. Oh, and also, you do know that XML-RPC, bless its ill-specified heart, is still around, right? There's a whole world of enterprise that isn't prepared to accept JSON-RPC.
- ender7 15y ago...I understand that eval() is dangerous. As noted in my comment. Anyway, what do you count as a "real language"? I assume you mean Java. Which is...fine. But Java is not the answer for everyone.
- MostAwesomeDude 15y agoJava, C, C++, Haskell, Python, Perl, Ruby, C#, Go, Scala, and Clojure are all better languages for systems development. (In no particular order.)
- human_error 15y agoNo love for OCaml and Erlang?
- htilford 15y agoIf JavaScript is such junk why hasn't any other language displaced it?
- MostAwesomeDude 15y agos/PHP/JavaScript/g in any other conversation about PHP; the same reasons all apply, including ease of learning curve, deployment inertia, etc. There's a massive amount of parallel community and language development between PHP and JS, and I feel that it's worth pointing out.