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

damien morton dmorton@REDACTED
Wed Nov 19 23:45:29 CET 2008

I ask "Have there be any proposals on how to implement this?:

Robert Virding responds "Yes, at least two, one by Joe Armstrong and
one by Richard O'Keefe which he calls frames. Richard's is more



Hmm, I see - these fixed-up records would be dictionary-like data
structures, with a supporting syntax for dictionary literals and
pattern matching. They would lose the very fast lookup access that
records have, though they would gain the expandability that a
dictionary-type (proplist,hashtable,tree) data structure offers.

Richard mentions that the internal representation need not be exposed
- and I think this is a good idea. To be able to switch from a
(sorted?) list of key-value-pairs to some other internal
representation is a necessary thing - once you add a dictionary data
structure to the language (as opposed to the library), people will use
it for all kinds of purposes - you cant bound its size.

The only way I could see a tighter integration between records and
frames is if the keys were stored separately from the values, with the
keys being the "schema" and the values being the data. You might lose
the extensibility aspects, but the the set of keys/slots would define
the "class" of the record itself. There might be some value in looking
at the V8 engine concept of hidden classes - the notion that many
instances would share the same set of keys and that you could have a
fast-path accessor for a given key and given "hidden class" - i.e. you
would know exactly which hash bucket to look in.

More information about the erlang-questions mailing list