Conversation
order is now more idiomatic
…ceRowAsCellBuilders: remove allCommodities parameter Caller must pass commidities in fmt.displayCommodityOrder instead. setBareWideCommodityOrder: according helper function
Member
|
Ok @thielema. |
Member
|
I'm fine with keeping things as they are for now. But from the warning it sounds like a potential source of future bugs:
so maybe we should mention it briefly in a dev comment at least. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I try to address the suggestion by Opus AI:
#2691 (comment)
The suggestion was to avoid the
allCommoditiesparameters by using thedisplayCommodityOrderfield of theAmountFormatparameters.Currently the exported reporting functions call lower-level functions with an
AmountFormatparameter, that is usually one ofnoCostFmt,oneLineNoCostFmt,machineFmtor modifications of those. On the way down some fields likedisplayCommodityanddisplayCommodityOrderare replaced. I do not like this design very much, because it is not obvious that some fields ofAmountFormatyou pass to a public reporting function are just overwritten, and thus ignored. I'd prefer if a user only passes values that have an effect.However, I also see that
AmountFormatis huge and an approach without overwriting fields would require many more function parameters.This draft pull request leaves the
AmountFormatmutation approach and setsdisplayCommodityOrderat a higher level in case of layout=barewide. In principle this works, but e.g. inmultiBalanceReportAsSpreadsheetPartswe need to extract thedisplayCommodityOrderfromfmt, which is aMaybe. This must beJustwhenheverlayout == LayoutBareWide, but we cannot enforce this condition in types.That is, I propose not to include this pull request, but maintain it closed for further discussion.
However, the first commit 5fe4e4a swaps parameters of
setDisplayCommodityBare, which I now think is more idiomatic. I think we should apply this one.