1. 程式人生 > >9.3 erlang併發程式設計雜項-程式碼替換

9.3 erlang併發程式設計雜項-程式碼替換

%%% start by compiling and loading the code
%%%   (this is done by c:c)
> c:c(code_replace).
...
> code_replace:test().
true
> global ! hello.
N = 0 Vsn A received hello
hello
> global ! global.
N = 1 Vsn A received global
global
> global ! process.
N = 2 Vsn A received process
%%% edit the file code_replace.erl
%%% recompile and load
> c:c(code_replace).
....
> global ! hello.
N = 3 Vsn B received hello