-
Notifications
You must be signed in to change notification settings - Fork 378
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
Rename Balance::claimable_amount_satoshis
to have a unique name
#2460
Rename Balance::claimable_amount_satoshis
to have a unique name
#2460
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #2460 +/- ##
==========================================
+ Coverage 90.33% 90.47% +0.13%
==========================================
Files 106 106
Lines 55732 56612 +880
Branches 55732 56612 +880
==========================================
+ Hits 50347 51218 +871
- Misses 5385 5394 +9
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but if I'd be reading definitely_claimable_amount_satoshis
I may be somewhat confused what it does, I guess due to the colloquial language?
Maybe we could make it more expressive, e.g., something like infallibly_claimable_amount_satoshis
or ensured_claimable_amount_satoshis
?
Yea, I'm not super happy with |
I vote removing the |
In Java/TypeScript, we map enums as a base class and each variant as a class which extends the base. In Java/TypeScript, functions and fields share the same namespace, which means we cannot have functions on an enum which have the same name as any fields in any enum variants. `Balance`'s `claimable_amount_satoshis` method aliases with fields in each variant, and thus ultimately doesn't compile in TypeScript. Because `Balance::claimable_amount_satoshis` has the same name as the fields, it's also a bit confusing, as it doesn't return the field for each variant, but sometimes returns zero if we're not sure we can claim the balance. Instead, we rename the fields in each enum variant to simply `amount_satoshis`, to avoid implying that we can definitely claim the balance.
b9a04c1
to
8302203
Compare
Done. |
In Java/TypeScript, we map enums as a base class and each variant as a class which extends the base. In Java/TypeScript, functions and fields share the same namespace, which means we cannot have functions on an enum which have the same name as any fields in any enum variants.
Balance
'sclaimable_amount_satoshis
method aliases with fields in each variant, and thus ultimately doesn't compile in TypeScript.Because
Balance::claimable_amount_satoshis
has the same name as the fields, it's also a bit confusing, as it doesn't return the field for each variant, but sometimes returns zero if we're not sure we can claim the balance.Instead, we rename the method
definitely_claimable_amount_satoshis
.