-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
add AnyResolver #126
add AnyResolver #126
Conversation
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.
The code looks good, but I suggest to use From
derive macro instead of writing a lot of boilerplate code (see my comments).
Even more important: feature-gated enums work really badly in practice. Just put the whole module behind a feature gate and let the enum contain both options. Also, the enum should be |
5cee5ba
to
7cb86e7
Compare
Thanks for the suggestions. I've applied almost all requested changes but I cannot derive
In this case they don't work bad, I've tried this enum and it works good, both selecting both features ( |
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.
We had this discussion years ago in rust-bitcoin, and the consensus was to avoid feature-gated enum variants at all cost: they always break compilation downstream once anybody changes the set of features. Simply, they are incompatible with any semantic versioning system.
I see no single argument for having them here - and a strong argument against (the above). If someone does not need one of them, they would not need this enum, thus feature gates add no value here.
This can be true in many cases, if I change features it's very likely that code will need to be updated. I don't see this as a strong argument in this specific case. Also, the
You're missing the argument that if I want to write a library that allows me to choose between just one or both indexers based on features, then I cannot use this |
Can you pls make this against master so we can check the CI? |
In the master branch the electrum resolver is missing. If you merge the v0.11 branch into master then I can make this against master |
Moving commit to #131, where we can run tests and check together with the whole set of new Electrum functionality |
They certainly are orthogonal and provide an additional dimension of complexity, but unfortunately they're unavoidable if targeting different architectures where certain functionality is simply unavailable and features depending on it cannot be compiled in. But in general, I agree with you when this is not the case. |
This PR adds an
AnyResolver
enum, which allows libraries to abstract the resolver type without using generics.