Really? Are you sure? Well, then describe us how long live running server turning around one loop/x function can change code of loop when you don't export loop/x function or some other function called from its loop. Just explain.<br>
<br><div class="gmail_quote">On Thu, May 1, 2008 at 6:39 PM, Richard Carlsson <<a href="mailto:richardc@it.uu.se">richardc@it.uu.se</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Jarrod Roberson wrote:<br>
> so are you saying you can do hot code reloading _without_ using the MFA<br>
> version of spawn?<br>
<br>
</div>Yes. If you spawn a process whose starting point is in the same module,<br>
you just use spawn(fun loop/0) or spawn(fun () -> loop(...) end). If you<br>
spawn a process that starts in _another_ module, you can write<br>
spawn(fun moo:loop()) or spawn(fun () -> moo:loop(...) end). Of course,<br>
in the latter case the function must be exported from moo, but you never<br>
need to export a function in the current module just because you want it<br>
to be the starting point of a process.<br>
<br>
I know that Joe's book (sadly) contains a remark that indicates that<br>
there is some problem with dynamic code loading and spawning from a fun,<br>
but that remark is just misleading.<br>
<br>
If you avoid exporting functions that shouldn't really be exported,<br>
tools like dialyzer can make a much better job of finding out what<br>
your program is doing (and tell you where you screw up).<br>
<div><div></div><div class="Wj3C7c"><br>
/Richard<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil