Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] libstate changes

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Paul Mahon <dufflebunk AT dufflebunk.homeip.net>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] libstate changes
  • Date: Thu, 13 May 2004 19:34:44 -0400

On Thu, 2004-05-13 at 15:15, Andrew wrote:
> Currently in libstate we have a number of functions for interacting with
> the /var/state/sorcery/depends file (DEPENDS_STATUS). Unfortunatly all
> these functions have hardcoded the use of DEPENDS_STATUS.
>
> Why do I care? Im trying to make it so that when you cast a bunch of
> spells, the depends file doesn't get updated until /after/ the spell
> successfully casts. Currently what happens is whenever you answer a
> depends question, it adjust the file regardless of whether or not you
> even go through with casting the spell, or if the spell succeeds, this can
> the be the cause of a lot of lint and other strangeness with this file.
>
> So what I need to do is store all the answers in a temporary file, then
> after the spell succeeds update depends. Uncommited answers can be kept in
> some special place so if a cast fails the same options can be preserved
> (etc. etc.)
>
> But all this boils down to being able to work with arbitrary files rather
> than DEPENDS_STATUS.
>
> Theres a couple of ways I can do this:
> 1) modify every function to have an extra argument somewhere, then fix
> all the callers to do the right thing.
> 2) like 1 but rename the functions, and keep the existing functions as
> wrappers that use DEPENDS_STATUS
> 3) change the value of DEPENDS_STATUS before calling the function
>
> Comments? Ideas?
>
> -Andrew

I would suggest Door #1, and use transactions.
Door #2 seems like extra work for no reason, but you may want to have a
check for the file name and default it to $DEPENDS_STATUS... or just
'exit 1'.
Door #3 is probably easiest, but has the most chance of blowing up in
our faces.






Archive powered by MHonArc 2.6.24.

Top of Page