Pure functions in D

downs default_357-line at yahoo.de
Tue Sep 23 23:52:25 PDT 2008


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.



More information about the Digitalmars-d mailing list