Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treacherous multi-currency auto-inference #758

Closed
Ekleog opened this issue May 8, 2018 · 5 comments
Closed

Treacherous multi-currency auto-inference #758

Ekleog opened this issue May 8, 2018 · 5 comments
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. journal The journal file format, and its features.

Comments

@Ekleog
Copy link
Contributor

Ekleog commented May 8, 2018

With eg. the following ledger file:

D 1,000.00€
 
2018-05-08 * test
    expenses:foo  $3
    assets  -3

The transaction is balanced to be $3 / -3€. Which sounds treacherous to me.

I think auto-inference could be straight-out removed, as the previous example could be rewritten with the more error-free:

D 1,000.00€
 
2018-05-08 * test
    expenses:foo  $3 @@ 3€
    assets

What do you think about it?

@wadeduvall
Copy link
Contributor

wadeduvall commented May 8, 2018

Personal opinion, this is the correct behavior. The default should apply to any unannotated value. Maybe we could implement some kind of warnings for this instead?

@Ekleog
Copy link
Contributor Author

Ekleog commented May 8, 2018

Oh I didn't explain clearly the issue I was thinking of. I do think the default should apply to any unannotated unit indeed. The issue I was considering is actually larger than this example: I think the following shouldn't balance (for the reason mentioned above of being treacherous in some cases):

2018-05-08 * test
    expenses:foo  $3
    assets  3€

BTW, another example was raised on IRC by @aszlig: intuitively, the market price is what would be used to balance such transactions (the fact that the manual states it's not what is done being in my humble opinion irrelevant to the fact that it's unintuitive). So this could lead to people writing such a transaction and thinking “oh alright I've bought it at market price”, not noticing the price was actually inferred and not verified in any way.

@simonmichael
Copy link
Owner

Thanks for the feedback. +1 catchy issue name!

Re your last point, Ledger does the opposite of what you find intuitive above - it infers a new market price from a transaction like that. I found this hard to learn and tried to simplify it by making a clear distinction between (one-time, fixed) transaction prices and (ambient, fluctuating) market prices.

I do think you should bring this up on the mail list as well, as most users won't see this, and changing the long-established behaviour needs wider discussion.

@simonmichael simonmichael added journal The journal file format, and its features. A-WISH Some kind of improvement request, hare-brained proposal, or plea. needs:discussion To unblock: needs more discussion/review/exploration labels May 8, 2018
@simonmichael
Copy link
Owner

See also: #1177.

@Xitian9
Copy link
Collaborator

Xitian9 commented Aug 4, 2021

Ever since 0f18378 we now have a way of addressing this. Calling hledger with --strict will not auto-infer prices in these cases. Furthermore, calling hledger check balancednoautoconversion will also check for these. I think this issue can be closed.

@simonmichael simonmichael removed the needs:discussion To unblock: needs more discussion/review/exploration label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. journal The journal file format, and its features.
Projects
None yet
Development

No branches or pull requests

4 participants