Tail/Non tail recursion

Bjorn Gustavsson <>
Mon Sep 1 13:41:47 CEST 2003


Thomas Lindgren <> writes:

[...]
> 
> BEAM for a time had some support for destructive
> update but I believe this intreacted badly with GC
> when generational garbage collection appeared, and was
> removed. This can likely be fixed if there is need for
> it.
> 

There is an instruction in Beam that does a destructive
setelement. The instruction is only safe to use immediately
after a call to the setelement/3 BIF (i.e. it must be called
before the next garbage collection). The instruction is
used in when updating a record with more than one new field,
such as:

        Rec#rec{a=A,b=B}

/Bjorn
-- 
Björn Gustavsson            Ericsson Utvecklings AB
      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list