<div dir="ltr">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.<div>
<br></div><div>PS: I thnk <a href="http://elixir-lang.org/">Elixir</a> might be able to do this, but I haven't looked at the documentation in-depth for a while and I may be wrong.</div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Thu, Aug 21, 2014 at 10:56 AM, Huxi Li <span dir="ltr"><<a href="mailto:huxili@gmail.com" target="_blank">huxili@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Hello all, </p>
<p dir="ltr">I am surprised to see the way the following module is coded when studying rabbit MQ server: </p>
<p dir="ltr"><a href="https://github.com/rabbitmq/rabbitmq-server/blob/master/src/supervisor2.erl" target="_blank">https://github.com/rabbitmq/rabbitmq-server/blob/master/src/supervisor2.erl</a></p>
<p dir="ltr">It is a duplication of erlang's supervisor.erl with minor changes. </p>
<p dir="ltr">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 ? </p>
<p dir="ltr">Thanks in advance.</p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">Huxi LI<br>
</p>
</font></span><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>