Comments (3)
I'd need to do a little thinking about other ramifications, but my gut reaction is that even without judging if this is a good idea or not this is a breaking change to js and Go CID libraries which could lead to a bunch of ecosystem breakage for pretty minimal gain.
IMO In order to show this is worth it we'd have to see some evidence of people already using cid.Equals incorrectly (i.e. assuming it works as the proposal suggests) since that would mean we're actually making things easier to understand for people instead of just forcing tricky library migrations and/or introducing subtle bugs to existing applications and libraries.
Note: we could always make another function has the newly proposed behavior (e.g. Equivalent, DataEquals, or something better 😁)
from cid.
This would be nice in some cases (would make GC simpler, for one...), but I think it would be an even bigger foot gun at this point. Using cid.String()
as a key would work differently than just using cid
.
I think making this change makes sense, as then "equal" CIDs would be the ones that point to the same content.
Note: this won't be the case regardless due to the codec itself. If content equality is desired, the multihash must be used directly.
from cid.
I conclude that for "equals" for CIDs means "byte identical objects" => A CIDv0 is always != CIDv1.
If you want to not care about the version, you can always implement that yourself. Likely you want to compare only the Multihashes anyway, therefore you could make a comparison like cid0.hash() == cid1.hash()
.
from cid.
Related Issues (20)
- Reproducible CID HOT 11
- Universal container format based on progressive specialization HOT 4
- Move CID spec to specs repo HOT 1
- Redefine CIDv1 to be <cidv1-multicodec><format-multicodec><multihash> HOT 4
- Move CIDs to the "multiformats" project HOT 14
- Specify project status HOT 1
- Cite URI specification
- "identity" multibase CIDv1 binary HOT 4
- Defining CID without Multibase prefix
- Revisit language of the whole spec
- CID Decoding Algorithm does not define "string", and allows false positives HOT 4
- CID Specification does not define "base58btc" HOT 3
- Create cid from signature HOT 1
- Create a cid for exist files? HOT 1
- Comparison and relationship with W3C DID standard HOT 3
- Add types to appease mypy! HOT 2
- Link to py-cid is outdated HOT 4
- Specify CID without a specific binary encoding
- CIDv2 idea: include the heights of trees in the CID HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cid.