Also, what are the limitations of JSON that EDN handles better?
* Can represent sets `#{1 2 3 4 "foo" "bar" true false}` (JSON only supports arrays)
* Maps/sets can contain arbitrary EDN as keys/values. `{[1 2] "foo", 5 :a, "5" :b, true -1, false 5}` or `#{[1 2] #{3 4} (5 6)}` (JSON only supports string keys on "objects")
* Supports clojure types like keywords (`:foo`, `:bar/baz`) and symbols (`foo`, `bar/baz`), and can be extended to support other values as well
2. JS has Map/Set which allow other composite types as keys and can be converted to objects for JSON serialization then deserialize back to Map/Set.
[
["key", "value"],
["otherKey", "otherValue"]
]
or [
{"key": "key", "value": "value"},
{"key": "otherKey", "value":"otherValue"}
]
or something else? And how can I distinguish between values which just happen to look like maps but are actually not maps? And what if the service I'm talking to does it differently? What if I'm comparing or sorting two JSON values, don't I have to modify the equality/hashcode/ordering logic now to interpret [
["key", "value"],
["otherKey", "otherValue"]
]
and [
["otherKey", "otherValue"],
["key", "value"]
]
as being equal and implement a new hashcode/ordering which treats them as equal?Quite a lot easier when this is just native to the format.
Because Clojure is better designed. As are many other languages.
Nodejs competes with Java in single threaded performance, I'll say normal JS code is faster than normal Java code. For web services that are IO bound, nodejs still competes with Java unless you go with all the batshit crazy complex reactive stuff in the Java world, supposedly is going to get better with the new green threads implementation.
Also, no JS code will be faster than Java. While both have insanely good JIT compilers that can output some truly, often surprisingly great machine code, java is all-around faster, if for no other reason, due to its killer GCs.
C++ isn't even a platform, period. It provides no runtime or anything else other than the language. If you build on top of the JVM ecosystem, similar to NET you get a cross platform, extremely performant ecosystem with millions if not billions invested into it basically for free.
And of course you can build a billion dollar company on a crappy tech stack, but if you had built it on a good one you'd still be a billion dollar company and be even better off. What a strange argument, you ought to make the best technical choice you can, it's a core part of anything you built. And getting a 10x performance on the JVM vs say Python, or smooth, non error prone concurrency in Clojure is a significant benefit.
In particular in business applications were you usually deal with data transformations, the single-threaded, mutable state type of design of some languages is awful. Clojure in particular was exactly made for this practical use case.
As for JSON, others have replied, but my point was perhaps not very well made. It's not just the limitations of JSON itself. By using the same language on both sides, I can avoid adapting to the limitations of any transit format. In other words, I can (pretty much) pass native data structures through and get them out on the other side. In my case, that means not just maps and vectors, but also sets, keywords, or UUIDs. Can this be done with JSON? Sure! But then I'd have an entirely new bug area to deal with (encoding/decoding, forgetting to coerce, etc).