-
Notifications
You must be signed in to change notification settings - Fork 59
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
Let's make fewer breaking changes #259
Comments
Code was introduced for backwards compatibility and kind of an "easy to get started" way. Back then, without out it, rust-libp2p wouldn't have upgraded to rust-multihash, but kept their fork. Power users should always define their own code table. So perhaps moving into its own crate makes sense, so people that don't want to define their own table can just use that. |
Thanks for sharing that bit of history! I wasn't aware of that. I am in favor of creating a |
I'd like to add that the idea that people would use a custom code table and not use the bundled conditional enum clearly failed. So what if we move that part into a separate crate without any features. It will just bundle some common ones (probably not all of the current ones). It would tick the box of "easy to get started" and if people that don't want to draw in hash functions they don't need, they can create their own table. |
Yeah that sounds pretty reasonable to me! :) Would you move the custom-derive too? Something like:
|
It's already its own crate, so I would just keep its current name. |
Good point. By convention however, I'd expect the trait that the derive macro implements lives in the "sister"-crate, i.e. We could fix this by extracting a single I don't really mind either way but I think it would be good to honor these conventions so either:
(All names subject to bike-shedding.) |
I would keep crate renames to a minimum, so that downstream users have as little work as possible. |
For users of |
Personally, I'd prefer to pick alternative names. The name I think we can ship a transition to my proposed structure in a backwards-compatible way, such that users don't need to rename their crates right away but only once they want to fix the deprecation warnings. In general, switching to a different crate with the same API is really minimal effort.
We should be able to do this because we are not actually changing any APIs in a backwards incompatible way but just need to align the types properly. |
The process looks good. Though I would keep names. I would name what you call |
I think we are on the same page here.
I can definitely see the benefit in not abandoning crate names so I am happy to go that way. Final question: Which crate do you see the
Initially I thought that the trait would move to |
As I also propose to remove the feature flags from This means that the |
Sounds good to me.
Sweet, I'll try to make some time for this tomorrow and prepare some PRs / branches. |
I don't think there is anything particularly actionable any more in here. |
In the same spirit as multiformats/rust-multiaddr#71, I want to raise awareness about how disruptive the breaking changes in this fundamental library are for the ecosystem.
I have a few suggestions:
Error
could be madenon_exhaustive
or completely opaque. The latter would be my personal preference as it gives you more flexibility as a library author.MultihashDigest
&Code
to a separate crate. All we need inrust-multiaddr
is theMultihash
type which acts as a type-safe representation for a multihash. The machinery aroundMultihashDigest
, the actual hash implementations etc could all live in a separate crate. This would reduce the API surface drastically and allowmultihash
to remain more stable (and almost dependency free)Code
uses conditional enum variants. That is not ideal. Features are additive across a dependency tree in Rust. Conditional enum variants can turn an exhaustive match in a library into a non-exhaustive one simply because the end-user activates more features ofmultihash
.Curious to hear your thoughts. (And happy to send PRs if we agree on something!)
The text was updated successfully, but these errors were encountered: