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

Mikael Karlsson karlsson.rm@REDACTED
Fri Mar 12 16:17:48 CET 2010


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

2010/3/12 Richard Carlsson <carlsson.richard@REDACTED>

> Mikael Karlsson wrote:
> > Hi,
> > I am trying to redefine the "new" function in a parameterized module
> > (ref. http://ftp.sunet.se/pub/lang/erlang/euc/07/papers/1700Carlsson.pdf
> )
> > ,
> > but the compiler crashes with:
> >
> > 11> c(ewgi_req.erl).
> > Function new/1 refers to undefined label 15
> > ./ewgi_req.erl:none: internal error in beam_dead;
> > crash reason: {{case_clause,{'EXIT',{undefined_label,15}}},
> >                [{compile,'-select_passes/2-anonymous-2-',2},
> >                 {compile,'-internal_comp/4-anonymous-1-',2},
> >                 {compile,fold_comp,3},
> >                 {compile,internal_comp,4},
> >                 {compile,internal,3}]}
> > error
> >
> > Any ideas?
> >
> > Workaround for now is to name the my "new" fun to "new1" and call the
> > default "new" from this one.
>
> Can you post a minimal example that triggers this?
>
>  /Richard
>


More information about the erlang-questions mailing list