[erlang-questions] Module dependencies - from newbie

Francis Stephens francisstephens@REDACTED
Tue Apr 29 13:09:42 CEST 2008


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080429/ad27a268/attachment.htm>


More information about the erlang-questions mailing list