Functions in data structures

Joachim Durchholz joachim.durchholz@REDACTED
Mon Jun 16 14:47:55 CEST 2003

Hi all,

I've been toying with Erlang, preparing for a Real-World(TM) project, 
and such a state provokes a specific kind of questions.

Mine are related to functions in data structures (I gather that 
Erlangese for "data structure" is "term" - is this correct?)

Assume that a term contains a function. Further assume that this term is 
converted to binary, transmitted to a different machine, and converted 
back to an Erlang term; or assume it is stored in Mnesia and later read 
back into Erlang. The base line is: the term is taken out of the Erlang 
run-time system and later reconstructed.
The question is whether the function can be called after reconstructing 
the term, under various circumstances:

1) Does it work if the function is a named function?
2) Does it work if the function is a named function, but the
    term is restored in an environment that doesn't contain
    that function?
    (E.g. the term is sent over the network and reconstructed
    in an Erlang run-time that doesn't have the same sources.)
3) Does it work if the function is anonymous?
4) Does it work if the function was constructed at run-time?
    (Most functional languages can construct functions at run-time
    by taking a given function and filling in a parameter with
    either a term or another function. I'm not sure that this is
    possible in Erlang, but I sincerely hope so...)


More information about the erlang-questions mailing list