Giter Club home page Giter Club logo

Comments (3)

aschmahmann avatar aschmahmann commented on June 18, 2024

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.

Stebalien avatar Stebalien commented on June 18, 2024

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.

vmx avatar vmx commented on June 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.