Semantics of xaccSplitSetShareAmount/SplitSetValue

Bill Gribble grib@billgribble.com
Tue, 7 Nov 2000 12:30:27 -0600


Recently, the Split structure changed to remove the "share_price"
field and add a "value" instead.  The "value" is price*amount, and
represents the total cost of the transaction.  Now we have just an
amount of share involved (the split->damount) and an amount of money
involved (split->value), which more accurately reflects what's
happening in the transaction.

Right now xaccSplitSetShareAmount and xaccSplitSetValue emulate the
old behavior as closely as possible.  That is, SetShareAmount sets the
split->damount, but also modifies the split->value as if there was a
split share_price that was constant.  SetValue sets the split->value,
but also changes the split->damount because with a fixed share_price
the damount has to drop.

I want to leave this behavior in the legacy API
(DxaccSplitSetShareAmount) but change the "preferred" API to just do
what it says: SetShareAmount is an accessor to change split->damount
and nothing else; SetValue is the same for value; and SetSharePrice
leaves a constant split->damount and modifies split->value, same as it
does now.

There's only a few places in the register that are migrated to the new
API; Dave, will it be a pain to fix those bits to use the new
semantics?  This is a much more straightforward way to do things, and
will make it much easier to debug some things.

Thoughts?  Does this change sound OK?

Thanks,
b.g.