<div dir="ltr">If you are alone, this will always be your friend, no matter of time or country <a href="http://www.developerduck.com/">http://www.developerduck.com/</a><div><br></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Sun, Mar 2, 2014 at 12:28 PM, t x <span dir="ltr"><<a href="mailto:txrev319@gmail.com" target="_blank">txrev319@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-module(m).<br>
-export([loop/0]).<br>
<br>
loop() -><br>
    receive<br>
        code_switch -><br>
            m:loop();<br>
        Msg -><br>
            ...<br>
            loop()<br>
    end.<br>
<br>
This is #$%-ing brilliant!<br>
<br>
At first, I thought:<br>
<br>
  "this is a stupid way to demonstrate global-loop vs local-loop"<br>
<br>
<br>
However, this does much more than that.<br>
<br>
  It means that<br>
<br>
  * when an existing loop is running<br>
  * after we do a hot reload<br>
  * after the code processes an old message<br>
  * it then calls the _new_ loop<br>
<br>
<br>
Yeah, preaching to the choir, but this is awesome, and I have no one<br>
else to share this intellectual excitement with. :-)<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Sun, Mar 2, 2014 at 1:31 AM, Gianfranco Alongi<br>
<<a href="mailto:gianfranco.alongi@gmail.com">gianfranco.alongi@gmail.com</a>> wrote:<br>
> I actually recommend the documentation, it covers this in a few paragraphs<br>
> <a href="http://www.erlang.org/doc/reference_manual/code_loading.html#id84603" target="_blank">http://www.erlang.org/doc/reference_manual/code_loading.html#id84603</a><br>
><br>
><br>
><br>
> On Sun, Mar 2, 2014 at 9:10 AM, Bob Ippolito <<a href="mailto:bob@redivi.com">bob@redivi.com</a>> wrote:<br>
>><br>
>> The remote call bar:hello() will always call the newest version of<br>
>> bar:hello/0. The calling module is irrelevant, even if the call happens from<br>
>> the old version of bar the newest version will always be called using that<br>
>> syntax. A local call from bar to hello() (or an equivalent closure) would<br>
>> use the current version referenced by that process.<br>
>><br>
>> Modules are not linked together in any way so how or when they were<br>
>> compiled is not so relevant.<br>
>><br>
>><br>
>> On Saturday, March 1, 2014, t x <<a href="mailto:txrev319@gmail.com">txrev319@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>>   I'm reading Chapter 8 of Programming Erlang, and I want to verify if<br>
>>> my mental model of erlang code reloading is correct. My erlang is a<br>
>>> bit weak, so I'm going to use C++ notation.<br>
>>><br>
>>> <a href="https://gist.github.com/anonymous/9299344" target="_blank">https://gist.github.com/anonymous/9299344</a><br>
>>><br>
>>>   Is the above correct with respect to *compile* and *lookup* ?<br>
>>><br>
>>>   It seems to me the defining characteristics of erlang's code hot<br>
>>> reloading is:<br>
>>><br>
>>>   * we have an "old" and a "new"<br>
>>>   * the new becomes the old, and we kill all processes spawned by the old<br>
>>><br>
>>>   Suppose we have<br>
>>><br>
>>>   * module foo, module bar;<br>
>>>   * foo:hi(), refers to bar:hello();<br>
>>><br>
>>>   * we recompile bar; now, all foo's references to bar, uses the<br>
>>> _latest_ bar, not the bar that existed when foo was compiled<br>
>>><br>
>>> If I have misunderstood anything, please correct me.<br>
>>><br>
>>> Thanks!<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>
>><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>
><br>
</div></div></blockquote></div><br></div>