[erlang-questions] defining default functions for a module

Jayson Vantuyl kagato@REDACTED
Wed Nov 11 01:32:04 CET 2009


Maybe require a callback module to have a dummy function, or is the  
function name really dynamic?  If it is dynamic (and your program is  
network accessible), are you sure you won't be leaking atoms (i.e.  
exposing an exciting DOS)?

Also, have you considered gen_event?  They're quite lovely, I assure  
you.

On Nov 10, 2009, at 3:25 PM, Pablo Platt wrote:

> Hi,
>
> I have a module that acts as a router.
> It gets requests and pass them to callback modules.
> Callback modules should have a function for each case unless they  
> need to do something specific.
>
> Is it ok to use erlang:function_exported/3 to check if the callback  
> module defined the needed function
> and if not to execute the default defined in the router?
> Will it cost me in performance or is it against the way I should do  
> things in erlang?
>
> I thought a behavior will solve my need but it only recommend a  
> module structure for the compiler.
>
> Thanks
>
>
>



More information about the erlang-questions mailing list