<p dir="ltr">Thanks for your advice. I will check mixer in more detail; it seems interesting. </p>
<p dir="ltr">Many people talk about Exilir, but I haven't yet been convinced by Exilir -- although I can't tell exactly why.</p>
<p dir="ltr">Regards, </p>
<p dir="ltr">Huxi</p>
<div class="gmail_quote">On 22 Aug 2014 22:11, "Federico Carrone" <<a href="mailto:federico.carrone@gmail.com">federico.carrone@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>Huxi, you should check <a href="https://github.com/opscode/mixer" target="_blank">https://github.com/opscode/mixer</a> from the Chef guys. I use it a lot and it works perfectly fine.</div><div><br></div>
<div>In Elixir you got protocols:<br>
</div><a href="https://pminten.github.io/blog/2013/09/11/elixir-patterns-mixins/" target="_blank">https://pminten.github.io/blog/2013/09/11/elixir-patterns-mixins/</a><div><br></div><div>They are awesome! I recommend that you try elixir.<br>
<div><br></div><div><a href="http://clojure.org/protocols" target="_blank">Protocols</a>, 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).</div>
<div>
<br></div><div>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.</div>
<div><br></div><div>Regards,</div><div>Federico.<br><div><br></div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 22, 2014 at 3:35 PM, Tyler Margison <span dir="ltr"><<a href="mailto:kolorahl@gmail.com" target="_blank">kolorahl@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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/" target="_blank">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"><div><div>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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
<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><font color="#888888">
<p dir="ltr">Huxi LI<br>
</p>
</font></span><br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">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>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">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><br clear="all"><div><br></div>-- <br><div dir="ltr"><a href="http://federicocarrone.com/" target="_blank">http://federicocarrone.com/</a><br></div>
</div>
</blockquote></div>