[erlang-questions] Reusing function in the module

Bengt Kleberg bengt.kleberg@REDACTED
Wed Dec 23 09:07:32 CET 2009


Is it your intention that you should have a single interface module to
all of the functionality in mod1.erl, mod2.erl etc?


On Tue, 2009-12-22 at 11:57 -0600, Senthilkumar Peelikkampatti wrote:
> I wanted to know what are the ways by which we can reuse functions
> with pure functional sense. Is that good to use extends
> (http://www.erlang.org/euc/07/papers/1700Carlsson.pdf)
> These are my requirements
> I have mod1.erl, mod2.erl etc
> mod1.erl - has different falovor of save and its utility functions
> mod2.erl - has update and its utility functions
> mod3.erl -- has same functions as mod1 but few more functions specific
> to itself. It is normally solved by either composition or inheritance
> in OOP. Borrowing a leaf from Joe's book (page 47-49), I can use
> pattern matching to do that. Here I need to club everything together
> and use different varient of pattern for variance of functionality.
> Is there any other way?

More information about the erlang-questions mailing list