xaccAccountEqual ?

John Ralls jralls at ceridwen.us
Sun Jan 8 14:52:41 EST 2012

On Jan 8, 2012, at 10:40 AM, Hendrik Boom wrote:

> On Sat, Jan 07, 2012 at 04:23:16PM -0500, Derek Atkins wrote:
>> Hi,
>> On Sat, January 7, 2012 2:35 pm, Hendrik Boom wrote:
>>> What's xaccAccountEqual for?  Is it actually something gnucash uses (I
>>> can't imagine what for), or is it just there because guile wants the smob
>>> to have a function that tests deep equality?
>> I don't understand the question.  It's there to test equality of two
>> Account objects. The API is used in a dozen places throughout the code.
> I can see testing two pointers to Account objects to see if they point 
> to the same Account object.  But I thought, perhaps wrongly, that the 
> engine would make sure that no account would ever have two 
> different Account objects, presumably by some kind of test before 
> creating the second Account object..  
> I do find myself wondering how one could ever be in the situation where 
> two accounts are Equal, with Equal subaccounts, and even Equal splits 
> except by amazing coincidence.  And then why that coincidence should be 
> worth testing for.  Evidently I'm misunderstanding something here. 

Not two accounts, two account objects -- both of which might have been loaded from the same data in storage, or might have been deep-copied. (There was a partially-completed book closing implementation that did that as the first step. We're slowly weeding out the remnants.) 

I thought you were working on learning to script Gnucash with Guile. Why are you worrying about the internals? (Yes, it's true that the scripting interface exposes too much -- *far* too much -- of Gnucash's internals. That's partly laziness on the part of those writing the wrapper code and partly a legacy of Gnucash 1.x when it was written mostly in Guile.

John Ralls

More information about the gnucash-devel mailing list