[erlang-questions] next(Erlang): "Fix up records so that records are first-class citizens and not just syntax saccharine for tuples?"

Richard O'Keefe ok@REDACTED
Tue Nov 25 00:13:19 CET 2008


On 22 Nov 2008, at 12:27 pm, Steve Davis wrote:
> Hmm. JSON uses Strings for property names -- is it really an impedance
> mismatch that you should dismiss so easily?
> i.e.
> JSON: { "Object": {"name": "Damien", "location": "here" }}
> Erlang: -record(object {name, location}) which has a tuple
> representation { "Damien", "here" }
> (case differences emphasized for effect)

Yes.  Once Unicode is dealt with, any possible slot label
in a JSON 'object' will have a corresponding atom usable
in a frame, and conversely.

JSON:	{"Object": {"name": "Damien", "location": "here"}}

Frame:	<{'Object' ~ <{location ~ "here", name ~ "Damien"}>}>

It's a little unfair to present an Erlang "equivalent" of the
JSON term shown that simply throws away the outer layer, but
if you want to do that, then
	<{location ~ "here", name ~ "Damien"}>
is it.




More information about the erlang-questions mailing list