[erlang-questions] Module dependencies - from newbie

Bengt Kleberg bengt.kleberg@REDACTED
Tue Apr 29 13:24:51 CEST 2008


Greetings,

Have you considered using the same module name for the different
implementations and hot load the different modules when you want to try
them?


bengt

On Tue, 2008-04-29 at 23:09 +1200, Francis Stephens wrote:
> I am currently having a problem finding a good way to manage some
> module dependencies.
> 
> I have a single module which called 'formula'.  It looks very similar
> to the core dict module which allows users to create, query and modify
> their dict datastructures.  My formula module allows users to create,
> query and modify boolean formula.
> 
> However, I am currently experimenting with different internal data
> structures for the formula module and would like to be able to swap
> them in and out of my program easily.  Currently there are a number of
> different modules which make function calls to the formula module and
> it seems that I would have to go and edit each function prefix for
> every call.
> 
> My current options seem to be to me
> 
> 1: Add a macro which will change the prefix for me at compile time.
> 2: Write each prefix as a Variable (Prefix:fun()) and pass in the
> appropriate module with each function call.  I believe those calls are
> significantly slower than non-variable prefixed function calls.
> 
> 3: reorganise my code in a more sensible way.
> 
> Currently I am still thinking about the code organisation in a very OO
> way and if there is a good Erlang approach to this kind of problem I
> would love to learn about it.
> 
> Thanks in advance.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list