[erlang-questions] I need to call unexported functions from theerlang shell

David Mercer dmercer@REDACTED
Fri Jun 15 19:10:40 CEST 2007


> Would it be any less icky to create a new BIF to work around the
> problem?
> 
>     erlang:apply(Function::atom(), Args::list(term()))
> 
> ... where Function must be in the caller's module and thus can act
> like any function in a module calling any other function in that
> module?  Then each source module would have added (via -include() or
> whatever) one more exported function:
> 
>     trap_door(Function, Args) ->
>         erlang:apply(Function, Args).

Forgive my ignorance as I am new to Erlang, but why is a new BIF required?
Can you not just export the trap_door function in any module you want the
trap door?  This does not require any new BIF as apply can already take two
arguments.

Cheers,

DBM




More information about the erlang-questions mailing list