[erlang-questions] beginner: Updating Data Structures

Richard A. O'Keefe <>
Tue Oct 30 23:17:46 CET 2007


On 30 Oct 2007, at 6:26 am, David Mercer wrote
[about the trouble involved in upgrading by adding a field to a record].

This is precisely the problem that Joe Armstrong and I have proposed
essentially the same solution to.  In particular,
if you have
	V = <item{name=>'fred', value=>27}>
then
	<item{name=>Name}> = V
should work and should bind Name = 'fred'.  This would require about
the same amount of space as current records; it would be a little slower
but not much; and it would not involve any preprocessor whatever.

The effect is that old code can extract information from new records
safely and correctly (as long as the meaning of the fields has not
changed) and can revise fields it knows about (copy this record with
these fields changed to those values); the only thing that doesn't work
is old code creating records from scratch which are read by new code.





More information about the erlang-questions mailing list