Every ParseMoneyError variant repeats the text it read #39
Labels
No labels
kind
bug
kind
enhancement
kind
refactor
workflow
needs-info
workflow
needs-triage
workflow
ready-for-agent
workflow
ready-for-human
workflow
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/lucre#39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
All four
ParseMoneyErrorvariants carry the text the parser read. Because thefield sits inside each variant rather than beside them,
text()andspan()are both four-arm matches whose only job is to reach a field every variant has.
Consider lifting the shared text out, leaving a struct that holds the text and a
kind that says what went wrong.
This needs a decision before it is built. miette's labels are declared per
variant, and the diagnostic output is a large part of what this error type is
for. Moving the text out may cost more in diagnostic wiring than the two matches
are worth. Settle that first — the answer may be to close this as wontfix.
It is a breaking change to a public type either way.
Acceptance criteria
text()andspan()reach the text without matching on the kindmise run cipassesBlocked by
#37. Both rework every place an error is built, and this decision is easier to
judge once a span is a type rather than a pointer subtraction.