[erlang-questions] Erlang code reuse
Fri Aug 22 22:11:01 CEST 2014
Huxi, you should check https://github.com/opscode/mixer from the Chef guys.
I use it a lot and it works perfectly fine.
In Elixir you got protocols:
They are awesome! I recommend that you try elixir.
Protocols <http://clojure.org/protocols>, if I am not wrong, come from
Clojure land. In a way they are remotely similar to duck typing in
Ruby/Python but better (subjective opinion).
However even with mixer/mixins, protocols or duck typing I am pretty sure
that they would not be useful for the supervisor2 scenario. In that case,
as Anthony Ramine pointed out, the supervisor should give you some option
to insert the new functionality.
On Fri, Aug 22, 2014 at 3:35 PM, Tyler Margison <> wrote:
> I'm not an Erlang expert, so others are more than welcome to correct me on
> this, but I do not believe Erlang allows "code reuse" in the manner you are
> suggesting. Erlang has behaviors, which are modules that define an
> interface and may have additional functionality of their own (see
> gen_server), but there is no way to inherit from a module and override
> select functions. I feel like this isn't a common scenario, though. In all
> of my own projects I very rarely, if ever, find myself re-writing entire
> modules to suit my own needs.
> PS: I thnk Elixir <http://elixir-lang.org/> might be able to do this, but
> I haven't looked at the documentation in-depth for a while and I may be
> On Thu, Aug 21, 2014 at 10:56 AM, Huxi Li <> wrote:
>> Hello all,
>> I am surprised to see the way the following module is coded when studying
>> rabbit MQ server:
>> It is a duplication of erlang's supervisor.erl with minor changes.
>> So my question is : Are there better ways of code reuse in erlang
>> without duplication of code as found in the above example ? Some sort of
>> polymorphism ?
>> Thanks in advance.
>> Huxi LI
>> erlang-questions mailing list
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions