Pure functions in D

Leandro Lucarella llucax at gmail.com
Wed Sep 24 05:15:12 PDT 2008


downs, el 24 de septiembre a las 08:52 me escribiste:
> Denis Koroskin wrote:
> > On Tue, 23 Sep 2008 02:24:10 +0400, Walter Bright
> > <newshound1 at digitalmars.com> wrote:
> > 
> >> bearophile wrote:
> >>>> They can be hot swapped (meaning replaced at runtime), because they
> >>>> do not rely on any global initialization or termination state.<
> >>>  This sounds true and interesting, but what can it be used/useful for?
> >>
> >> I've heard mention many times that languages like Erlang allow hot
> >> swapping meaning the software can be upgraded without bringing the
> >> system to a halt first.
> > 
> > Yes, Java has some support of hot-swapping, too.
> > 
> > Imagine you have a MMORPG server. Applying a patch or adding some
> > additional content is a daily event. Doing so without disconnecting the
> > people (especially if there are thousands of player online) is desirable
> > but hardly available in C/C++.
> 
> I did that with an IRC bot a while back.
> 
> Just build a new executable, halt all your running tasks, dump the system state to a file (*including socket handles*), use the exec system call to replace the process with the new executable, and read the system state back, replacing handles as you go.
> 
> No dropped connections.

Using dynamic libraries with dlopen can be useful for hot-swapping too.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
El trabajo no sólo tara, sino que tarará y seguirá tararando.
	-- Ricardo Vaporeso



More information about the Digitalmars-d mailing list