[erlang-questions] new new in parameterized modules causes beam_dead

Mikael Pettersson mikpe@REDACTED
Sat Mar 13 14:04:27 CET 2010


Mikael Karlsson writes:
 > Thank you for the info Richard,
 > while having the attention of the originator:
...
 > 2.
 > I like that the new function return the module like a tuple, it makes it
 > almost lika a dual nature of records and it makes it very easy to write
 > setter functions in the module:
 > -module(test,[A,B,C,D,E,F,G,H,I,J]).
 > -record(test,{a,b,c,d,e,f,g,h,i,j}).  %% record specification local in
 > module (no includes)
 > -export([set/2]).
 > 
 > set(a,V) -> setelement(2,THIS,V);
 > %% or
 > set(b,V) -> THIS#test{b=V};
 > etc...
 > 
 > Is this tuple format something that can be considered future proof in the
 > implementation of parameterized modules?

No, the fact that instances of parameterized modules currently
are implemented as tuples is purely an implementation artifact
and not something you should rely on.

If poking the representation like that solves a real problem or
makes some code much easier to write, then perhaps you should
raise a feature request for that?

/Mikael

(And please don't top-post.)


More information about the erlang-questions mailing list