Sharing and append in EC (was RE: Magnus and EC)

Thomas Johnsson XA (LN/EAB) thomas.xa.johnsson@REDACTED
Wed Feb 16 16:43:57 CET 2005

> What public info there is, is given in:
>   Maurice Castro, SERC-0128: EC: An Erlang Compiler, Software
>   Engineering Research Centre, RMIT, July 2001.
> [..snip..]
> And by all means hassle me with questions about EC :-)
> Cheers
> Lawrie

Ok, will do (:-)
Section 6.3 in the above-mentioned document caught my eye;
here it is described that a cons cell in the implementation
is a triple, with pointers to (1) the head element, (2) the next cons cell,
and (3) the last cons cell of the list (called the Tail).
"Thus O(1) list append performance is assured only when the head of the 
first and the second lists are provided to append".

Doesn't this cause disastrous side effects with shared values?
Eg, like
   Prefix = "prefix",
   S1 = Prefix ++ "first",
   S2 = Prefix ++ "second",

-- Thomas

More information about the erlang-questions mailing list