[erlang-questions] Reusing function in the module

caio ariede caio.ariede@REDACTED
Wed Dec 23 13:10:07 CET 2009


Can you exemplify the "pattern matching way"?

Caio Ariede
http://caioariede.com/



On Wed, Dec 23, 2009 at 6:07 AM, Bengt Kleberg
<bengt.kleberg@REDACTED> wrote:
> Greetings,
>
> Is it your intention that you should have a single interface module to
> all of the functionality in mod1.erl, mod2.erl etc?
>
>
> bengt
>
>
> 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?
>>
>>
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list