GithubHelp home page GithubHelp logo

Merge cmpopts and cmp package? about go-cmp HOT 3 OPEN

zombiezen avatar zombiezen commented on August 19, 2024
Merge cmpopts and cmp package?

from go-cmp.

Comments (3)

neild avatar neild commented on August 19, 2024 1

At this point in time, it's a bit awkward to merge cmpopts into cmp since there would now be two ways to get at the cmpopts functionality.

Presumably everything in cmpopts would be replaced with a forward to the corresponding symbol in cmp, and marked as deprecated.

I think the separation makes a lot of sense from the perspective of the implementation, but it's pretty confusing as a user. Even as a user with an above-average understanding of cmp's internals.

from go-cmp.

meling avatar meling commented on August 19, 2024 1

I came here to ask the same question as @zombiezen. I just want to point out that the cmpopts package isn't prominently visible from the cmp documentation, so as a user I spent a bit of time to find what I was looking for, and couldn't in the cmp package alone. When I eventually discovered the cmpopts package I found what I needed.

So I would also encourage merging the two packages to make the documentation easier to use.

from go-cmp.

dsnet avatar dsnet commented on August 19, 2024

The original intention was to design a comparison library that was highly extensible with a small number of options.

Implementing cmpopts as a separate package kept the implementation of cmp honest such that cmpopts does not rely on internal details of cmp. In other words, cmpopts is forced to be entirely implementable in terms of the first-class options provided by cmp. This was done in reaction to other comparison libraries I looked at that supported many options and each option deeply touched internal details of the overall comparison logic.

That said, from a end-user perspective, I can see how the two being in the same package can be convenient. At this point in time, it's a bit awkward to merge cmpopts into cmp since there would now be two ways to get at the cmpopts functionality.

from go-cmp.

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.