On Sun, Aug 4, 2013 at 1:57 AM, John Wiegley <[email protected]> wrote:
> but I also don't want people to pay for a feature they never use, unless > you convince me that balance assertions are being used by everyone. > Actually, my point is a more general one; not just about balance assertions. Suppose for example, we have a definition of a constant x, and a transaction refers to the constant x, before it is defined in the file. What should happen? This becomes especially tricky when you have multiple files being included. Should the users think of the file that is included as being literally included at the position of the include statement? Does that work recursively for all second-level inclusions? For example: #include "definitions.ledger" followed by some transaction that uses a definition made in "definitions.ledger". To the user this might seem like the correct order of parsing: definitions.ledger is parsed first and then the rest of the file which included the file is parsed. But that may not be how parsing works in a real parser. You might first parse the whole contents of one file first, collect its includes and then parse those. These considerations might lead to ambiguities. I feel, in the case of ledger, it is possible to take a general stand on such problems: "the order of specification doesn't matter". So it wouldn't matter if definitions are "made before" or "parsed before" or "processed before", etc. The user can expect consistency of results irrespective of how the internals of the program behave. The user might have to sacrifice performance, but in the case of ledger, I don't see a loss beyond milliseconds or seconds in a typical case (unless we are crunching hundreds of accounts with millions of transactions, in which case, I could attempt an alternative argument for consistency :) ). > Lastly, how do you order three transactions on the same date from three > different files, which may even be inter-dependent? > If we take a stand about consistency as outlined above, then I imagine the following solutions: - program throws an error when it finds such cases - user then needs to manually order the specification using numbers or time, etc - alternatively, user opts for "auto-ordering" using a command line flag. This is not on by default. -- *Harshad RJ <http://lavadip.com>* -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
