[人] Ren - The Human Notation |
If this site looks like json.org, it's because we think imitation is the sincerest form of flattery. |
"Ren Example 1" ; string [] ; empty list #[] ; empty map [a 1 true #three] ; non-empty list #[a: 1 b: "two"] ; non-empty map -42 ; number 98.6 ; another number true ; literal true false ; literal false none ; literal nil/null/nada #[ ; a bigger map space-newline-tab: " ^/^-" quote: "^"" ;special: "#[]:^"^^;" ;reserved: "/@$%,{}<>()" unicode: "^(1234CDEF)^(abcd)^(ef4A)" all-in: 100% sci-phi: 0.1618e1 url: http://www.ren-data.org/ email: info@ren-data.org date: 2013-04-17/18:37:39 iso-date: 2013-04-17T18:37:39-0600 ip-addr: 127.0.0.1 geo: 43.5x116.7 hex: #{DECAFBAD DEAD 00FF} base-64: 64#{3sr7rd6tAP8=} ]
Goals:
Uses:
Ren was born of a desire for a lightweight data exchange language that is easy to use in non-wire-transport scenarios like configuration files. The main influence on Ren's design was the REBOL messaging language, by Carl Sassenrath, which also influenced Red.
JSON gets a lot of things right, simplicity and key data structures being foremost. Its less-is-more approach makes it widely usable as a lowest common denominator, and there was really no way to do more-is-more and still be a subset of Javascript. That makes some things a little harder to express elegantly. For example, JSON keys are strings, meaning (most of the time) you have to enclose them in double quotes. Programmers are used to this, but most end users are not. Since JSON is not intended to be edited directly by people, that makes sense. Support for comments in JSON was also removed, for the same reason. Douglas Crockford deserves praise for making the hard decisions that focused JSON and helped make it successful. Ren has different goals, but a similar constraint in wanting to be a subset of Rebol-like languages as much as possible.
TOML is another highly focused language that has a number of implementations. Like JSON it strives for a minimal design that meets a specific need. In TOML's case, that need is mapping configuration file data to hash tables. TOML also includes support for date-time values and does not require the names in name-value pairs to be enclosed in quotes. It also doesn't require commas between name-value pairs, which makes it much nicer for its intended use.
JSON and TOML aren't the only formats available of course. There are YAML, EDN, ProtoBuf, Thrift, MessagePack, and more. Each has its strengths, and each has different goals and priorities. Ren is no different. Ren's goals are similar to those of YAML, but with a key added goal of simplicity. YAML looks simple on the surface, but has a large spec that belies hidden complexity. Unlike YAML, indentation and dashes have no special meaning in Ren. A key phrase from the YAML spec, that Ren agrees with is:
When data is easy to view and understand, programming becomes a simpler task.