<!-- MHonArc v2.4.4 --> <!--X-Subject: [MUD-Dev] Re: atomic functions --> <!--X-From-R13: "Tryvk O. Qebrf" <sryvkNkf1.fvzcyrk.ay> --> <!--X-Date: Thu, 7 May 1998 08:23:53 -0700 --> <!--X-Message-Id: 199805071521.RAA21101#xs1,simplex.nl --> <!--X-Content-Type: text/plain --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, [MUD-Dev] Re: atomic functions</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:felix#xs1,simplex.nl"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00459.html">Previous</a> | <a href="msg00461.html">Next</a> ] Thread: [ <a href="msg00541.html">Previous</a> | <a href="msg00470.html">Next</a> ] Index: [ <A HREF="author.html#00460">Author</A> | <A HREF="#00460">Date</A> | <A HREF="thread.html#00460">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>[MUD-Dev] Re: atomic functions</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> <LI><em>Subject</em>: [MUD-Dev] Re: atomic functions</LI> <LI><em>From</em>: "Felix A. Croes" <<A HREF="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</A>></LI> <LI><em>Date</em>: Thu, 7 May 1998 17:21:05 +0200 (MET DST)</LI> <LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> <LI><em>Sender</em>: "Petidomo List Agent -- Kanga.Nu version" <<A HREF="mailto:petidomo#kanga,nu">petidomo#kanga,nu</A>></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> Shawn Halpenny <malachai#iname,com> wrote: > On Wed, May 06, 1998 at 09:34:27PM +0200, Felix A. Croes wrote: >[...] > > In my design, events are only cancelled if they fail to commit their > > changes. Uncaught errors cause the event to terminate, but do not > > make it skip the commit phase. > > I do not understand how that can work. A careless builder who forgets a > range check on some value could corrupt objects and the results are not > easily traceable. Perhaps I'm using a different definition of "error"? > Simplistic example: > > function SetMaxDamage(n) > { > if (n < 0) > throw out_of_range > > max_damage = n > } > > SetMaxDamage(-1) is called in context of an event. The exception is what I > term an error: throw out all local data and forget this event. There is > no other clause to catch that exception and recovery is not possible, so it > must terminate the event. Letting it continue on and commit changes, let > alone schedule other events because it is allowed to commit, isn't > acceptable. Letting it continue executing is certainly unacceptable. Letting it abort on the error and commit changes made before the error occurred may still be unacceptable from your point of view, but is okay for me. It works for a large number of muds, including all those using LPC, ColdC or MOO. Nevertheless, forgetting changes made if an error occurs can be useful, and that is where atomic functions come in. >[...] > > I contest this :) I claim that it is very useful indeed, and not > > at all illusionary. I frequently find that actions which have to > > be atomic -- for instance, moving a hungry dragon into a room, > > which changes both the environment of the dragon and the inventory > > of the room -- are part of a larger event, the actions of which > > I want to be executed precisely in that other without other > > events intervening. > > Moving the hungry dragon into the room does not have to be an atomic > action. Removing the dragon from its current room is one event, putting it > into the next room is another. You have broken up the event into smaller ones, but for my argument it does not matter -- removing a dragon from a room still requires changes to both the dragon (new environment) and the room (dragon removed from inventory). If the event fails halfway, the inventory hierarchy has become inconsistent. Making the movement part of the event atomic prevents this. > This is an attempt to minimize the number > of C&C collisions if you have a lot of these things going on (get rid of the > container-room ideology and this is even less a factor--something I'll > probably end up going with). The movement events will be executed in the > correct order, since the dragon removal event posts the dragon insertion > event only if it successfully C&C's. But breaking up the event into smaller ones, even though these are executed in the proper sequence, does not help meeting the other requirement: that no other events intervene. Felix Croes -- MUD-Dev: Advancing an unrealised future. </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00459.html">[MUD-Dev] Re: atomic functions</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00461.html">[MUD-Dev] Re: quickie CGDC report</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00541.html">[MUD-Dev] Re: atomic functions</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00470.html">[MUD-Dev] Re: atomic functions</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00460"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00460"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><STRONG>[MUD-Dev] Re: atomic functions</STRONG>, <EM>(continued)</EM> <ul compact> <ul compact> <ul compact> <ul compact> <LI><strong><A NAME="00613" HREF="msg00613.html">[MUD-Dev] Re: atomic functions</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 15 May 1998, 20:44 GMT </LI> </ul> </ul> </ul> <LI><strong><A NAME="00454" HREF="msg00454.html">[MUD-Dev] Re: atomic functions</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 07 May 1998, 06:03 GMT </LI> <LI><strong><A NAME="00455" HREF="msg00455.html">[MUD-Dev] Re: atomic functions</A></strong>, Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Thu 07 May 1998, 12:35 GMT <UL> <LI><strong><A NAME="00541" HREF="msg00541.html">[MUD-Dev] Re: atomic functions</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 13 May 1998, 18:09 GMT </LI> </UL> </LI> <LI><strong><A NAME="00460" HREF="msg00460.html">[MUD-Dev] Re: atomic functions</A></strong>, Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Thu 07 May 1998, 15:23 GMT </LI> <LI><strong><A NAME="00470" HREF="msg00470.html">[MUD-Dev] Re: atomic functions</A></strong>, Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Fri 08 May 1998, 12:51 GMT </LI> <LI><strong><A NAME="00564" HREF="msg00564.html">[MUD-Dev] Re: atomic functions</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 14 May 1998, 06:05 GMT </LI> <LI><strong><A NAME="00566" HREF="msg00566.html">[MUD-Dev] Re: atomic functions</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 14 May 1998, 06:05 GMT </LI> </ul> </LI> <LI><strong><A NAME="00289" HREF="msg00289.html">[MUD-Dev] META: Filtering suggestions</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Thu 30 Apr 1998, 23:49 GMT </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>