Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  dynamic code replacement

markn at cs.mu.OZ.AU
Posted: Fri May 14, 1999 5:42 am Reply with quote
Guest
G'day !

I was wondering if there are currently any know problems or issues or gotchas
with dynamic code replacement under Erlang.


thanks,
mark





Post generated using Mail2Forum (http://m2f.sourceforge.net)
tobbe at serc.rmit.edu.au
Posted: Fri May 14, 1999 6:06 am Reply with quote
Guest
> I was wondering if there are currently any know problems or
> issues or gotchas with dynamic code replacement under Erlang.

No...

Well, in the case where you are running a server. Make sure that
you make a module prefixed recursive call to the top loop.
Example:

loop(Data) ->
receive
X ->
NewData = do_stuff(Data,X),
?MODULE:loop(NewData)
end.

You also have to export (in this case) the loop/1 function.

/Tobbe







Post generated using Mail2Forum (http://m2f.sourceforge.net)
ulf.wiger at etxb.ericsso
Posted: Fri May 14, 1999 8:21 am Reply with quote
Guest
Mark NG wrote:
>
> G'day !
>
> I was wondering if there are currently any know problems or issues or gotchas
> with dynamic code replacement under Erlang.
>
> thanks,
> mark

Not really any issues in the sense that it wouldn't work
Dynamic code replacement can be about as easy or complex as you
want/need to make it. The easiest part is simply loading the module. For
library code, this is all that's needed.

Torbjorn Tornkvist wrote:
> Well, in the case where you are running a server. Make sure that
> you make a module prefixed recursive call to the top loop.
> Example:
>
> loop(Data) ->
> receive
> X ->
> NewData = do_stuff(Data,X),
> ?MODULE:loop(NewData)
> end.

If your new version has a different representation of Data, this will
not work. For this eventuality, OTP provides a framework for performing
synchronized code change with hooks for transformation of internal
state.

A couple of pointers:

- If you want to learn about OTP's system messages
http://www.erlang.org/doc/doc/index.html
(Click on "Design Principles")

- If you want to learn about OTP's release handling:
http://www.erlang.org/doc/doc/lib/sasl-1.6.3/doc/index.html
(see the User's Guide.)

/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum