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

Mikael Karlsson <>
Sat Mar 13 13:04:07 CET 2010

Thank you for the info Richard,
while having the attention of the originator:
Are there any documentation on parameterized modules more than
More like a spec or so and (maybe) updated for any changes?

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:
-record(test,{a,b,c,d,e,f,g,h,i,j}).  %% record specification local in
module (no includes)

set(a,V) -> setelement(2,THIS,V);
%% or
set(b,V) -> THIS#test{b=V};

Is this tuple format something that can be considered future proof in the
implementation of parameterized modules?


2010/3/12 Richard Carlsson <>

> Mikael Karlsson wrote:
>> Yes,
>> I just figured out what the problem is.
>> In my new "new" function I call another function which I defined in my
>> module:
>> helper_fun(X) -> xxx.
>> new(Z) ->
>>  A = helper_fun(Z),
>>  ...
>>  intance(X,Y,Z1).
>> This does not work.
>> It seems that other funs can only be called from an instanciated module,
>> like:
>> ..
>>  M1 = mod1:new(Z),
>>  M1:helper_fun(X),
>> ..
>> Works OK after removing internal calls.
>> /Mikael
> Yes, those extra functions will not be "static" like new/1. However,
> the compiler shouldn't crash like that. Thanks for reporting it.
>    /Richard

More information about the erlang-questions mailing list