Erlang futures

Ulf Wiger <>
Wed Apr 18 22:01:14 CEST 2001


On Wed, 18 Apr 2001, Robert Virding wrote:

>For example this is also what is wrong with ets:filter/3, it returns a
>list but it should really return a filtered ets table.

Hmm, except that ets tables are not garbage collected, and there's
an upper limit on the number of ets tables that can be created.
Such a function would not be side effect free, in the sense that 
the caller would then explicitly have to deallocate the automatically
created ets table... unless:

ets:filter(Tab, F, A, ResultTable) -> true.

where the result of the filter operation is found in ResultTable

But the basic idea of ets:filter/3, ets:foldl/3 et al was that they
would be analogous to the corresponding lists functions. The 
most important reason for putting them in was that it would be 
easy to modify code that first called ets:tab2list(Tab) and 
then iterated over the result -- this being bad because it causes
trouble for the Erlang memory handling.

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list