TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rich Hickey: extensible data notation

219 pointsby Peterisover 12 years ago

14 comments

jacobolusover 12 years ago
Nice advantages over JSON: more compact, easier to pretty print, includes an integer type, non-string map keys, has a nice built-in extension mechanism (which is much more elegant than any ad-hoc thing that JSON can support).<p>Things that probably make sense coming from Clojure, but seem somewhat unnecessary for a general purpose data interchange format: explicit character type (as compared to length 1 strings (which could optionally use the extension mechanism if necessary)), separate types for vectors and lists (seems like the extension mechanism could handle this if it’s ever necessary; to some extent this criticism holds for sets too, but those are also more independently useful).<p>One type not included that I find useful: some kind of "raw" string wherein backslashes are interpreted literally, and double escapes aren’t required all over the place.<p>Possible point of confusion that should be spelled out more explicitly: by the grammar provided, a floating point number requires an explicit leading digit. That is, '0.5' cannot be spelled '.5'. (Should an implementation accept '.5' as a number, or reject it as badly formed?)<p>Also, does <i>"a floating-point number may have the suffix M to indicate that exact precision is desired"</i> mean that it should be interpreted as a decimal number? Might be worth saying that directly.<p>It would be nice to see a bit more guidance about <i>"Symbols are used to represent identifiers, and should map to something other than strings, if possible."</i> Perhaps this could include examples of what Rich Hickey &#38; al. think would be useful interpretations in JavaScript and Python (to pick two obvious popular examples).<p>Most of all, it would be nice to see a clear explicit treatment of Unicode for strings/symbols (I’d recommend utf-8 here), including possible ways of escaping code points in strings. Confusions about Unicode are one of the main points of incompatibility between JSON implementations, and the JSON spec has more to say about the subject than this current spec does.<p>One nice built-in tag to add: base64 raw data, using one of the typical base64 encodings, which should be described in the spec to avoid any confusion.<p>Question: if a tagged element is considered a unit, can another tag be put in front of one? That is, something along the lines of '#outer_tag #inner_tag "built-in element"', where in the code which interprets the file, whatever object is produced by the inner_tag's extension is sent as input to the outer_tag's? It’s worth clarifying this so that implementors make sure to add the case to their test suites.
评论 #4489740 未加载
评论 #4487987 未加载
falcolasover 12 years ago
So, XML, YAML, JSON, and the dozen plus other markup notations were not suitable because they used C style delimiters instead of Lisp style delimiters?<p>Snark aside, what does this buy us that these existing markup languages don't?<p>I appreciate all that Rich Hickey does for programmers, but aside from his name, this just adds to the noise that already exists in this domain.
评论 #4487579 未加载
评论 #4487761 未加载
评论 #4487639 未加载
评论 #4488006 未加载
评论 #4487934 未加载
snprbob86over 12 years ago
I added a spot on the wiki for links to implementations:<p><a href="https://github.com/richhickey/edn/wiki/Implementations" rel="nofollow">https://github.com/richhickey/edn/wiki/Implementations</a><p>A few months ago, I started doing an implementation of a Clojure reader in C and a Ruby extension, but I ran out of time to work on it. If anyone wants to use my code as a starting point, please do! I'd love to see more usage of Clojure forms... errr... "EDN" in the wild!
ChuckMcMover 12 years ago
<a href="http://tools.ietf.org/html/rfc4506" rel="nofollow">http://tools.ietf.org/html/rfc4506</a><p>That is 'XDR' (eXtensible Data Representation) which has similar goals and is reasonably mature. Of course JSON (<a href="http://www.ietf.org/rfc/rfc4627.txt" rel="nofollow">http://www.ietf.org/rfc/rfc4627.txt</a>) does this as well but using character code points. Not to mention XML and ASN.1. In perl there is YaML (<a href="http://search.cpan.org/dist/YAML/" rel="nofollow">http://search.cpan.org/dist/YAML/</a>) too.<p>I'm wondering what this one brings to the table. The readme file doesn't say.
评论 #4487586 未加载
评论 #4489695 未加载
评论 #4487701 未加载
评论 #4490065 未加载
michaelsbradleyover 12 years ago
It seems one immediate application is in Datomic's new REST API:<p><i>Datomic gets a REST API</i><p><a href="http://news.ycombinator.com/item?id=4487467" rel="nofollow">http://news.ycombinator.com/item?id=4487467</a><p>I'm developing with Clojure on a daily basis at present, and it's cool to see such a slick data notation take on new life outside of my REPLs and .clj files.<p>Now, what would be really interesting is if <i>edn</i> (or an official superset of it) could be formalized with "hypermedia controls".<p>See: <i>Hypermedia-Oriented Design</i><p><a href="http://amundsen.com/articles/hypermedia-oriented-design/" rel="nofollow">http://amundsen.com/articles/hypermedia-oriented-design/</a><p>One of the shortcomings of JSON is that as a standardized hypermedia type, it doesn't offer any hypermedia controls. There are efforts to standardize JSON-derived types which do provide such controls:<p><i>HAL</i><p><a href="http://tools.ietf.org/html/draft-kelly-json-hal-03" rel="nofollow">http://tools.ietf.org/html/draft-kelly-json-hal-03</a><p><i>JSON-LD</i><p><a href="http://json-ld.org/" rel="nofollow">http://json-ld.org/</a><p><i>Collection+JSON</i><p><a href="http://www.amundsen.com/media-types/collection/" rel="nofollow">http://www.amundsen.com/media-types/collection/</a><p>It would be great to see <i>edn</i> take on that challenge in its early days as an extra-clojure, general purpose data notation. I'm convinced that Fielding is right about REST implying HATEOAS (others argue for "practical REST"), but you can't robustly implement REST/HATEOAS APIs with a media type that outright lacks hypermedia controls.
评论 #4487773 未加载
skrebbelover 12 years ago
i think that one of the reasons why JSON got so popular is that it was artificially restricted to a smaller language than the actual object notation in JavaScript. This meant that it was easy to write a parser for which, in turn, happened a lot.<p>I see lots of optional extras here that might make humans a little happier but may increase the chance that different implementations are incompatible.<p>YAML had this problem, too.
donsover 12 years ago
As with JSON, no support for algebraic data types (so tagged unions or recursive data types)?
评论 #4488757 未加载
评论 #4488638 未加载
评论 #4488679 未加载
6renover 12 years ago
Extreme expressiveness makes a data-format harder to understand at a glance; and data is generally dumb enough not to need it.<p>Examples are helpful. An example of an example: <a href="http://www.sinatrarb.com/" rel="nofollow">http://www.sinatrarb.com/</a>
评论 #4487958 未加载
评论 #4487820 未加载
Flowover 12 years ago
I get that it's a richer format than JSON, with the introduction of sets, dicts and so on, but what I felt wasn't explained was the "extensible" part. Can someone give an example of this?
评论 #4488626 未加载
评论 #4488050 未加载
shaunxcodeover 12 years ago
<a href="https://github.com/shaunxcode/jsedn" rel="nofollow">https://github.com/shaunxcode/jsedn</a><p>This is my attempt at a js version. parse is working - now working on encode.<p>There is really nothing stopping it from working in browser other than I am currently working on it as an npm/node js package.<p>I can successfully load datomic schemas and .dtm files which I think is a pretty good test.<p>Need a lot more tests around int/float wrt the arbitrary precision. I would love to have some pull requests if anyone wants to write valid tests which break it.
Groxxover 12 years ago
&#60;redacted&#62;<p>I'll stick with JSON for one simple reason: you can have <i>anything</i> as a key (as long as it's escaped). The fact that this can't means you either a) can't use it if you have more-complex keys for some reason, or b) you have to use some non-standardized packing format to encode your illegal keys.<p>&#60;/redacted&#62;<p>edit: thanks repliers, I missed part of the spec. Ignore!
评论 #4488125 未加载
评论 #4487870 未加载
评论 #4487876 未加载
andrewflnrover 12 years ago
I kind of like the tagging syntax. It almost seems like they should really be lists with the first tag in function position, but I don't know think that would interop with real Clojure. I tried to come up with something similar, but somehow couldn't generalize to tagging any random object. When in doubt, generalize...<p>PS: I'm just learning Clojure.
评论 #4492683 未加载
icrbowover 12 years ago
<a href="https://bitbucket.org/dpwiz/hedn" rel="nofollow">https://bitbucket.org/dpwiz/hedn</a><p>My stab at haskell parser/encoder and type converter. Would be glad for a friendly hug^W code review and packaging suggestions.
tree_of_itemover 12 years ago
Could the blessed days of the s-expression interchange format finally be here?