Code Monkey home page Code Monkey logo

Comments (4)

alysbrooks avatar alysbrooks commented on August 17, 2024

This is an interesting idea, and I agree that it would make the output easier to interpret. I haven't noticed deep-diff output being out of order, possibly because I mostly use deep-diff2 through Kaocha, so I don't see the original order. Is there a particular situation where this came up in?

I don't how optimized ordered collection libraries are or how big of dependencies they are, so I wonder if the best way is to make it configurable, require the user to provide the dependency, or both.

from deep-diff2.

plexus avatar plexus commented on August 17, 2024

The thing is that this will only help if people are themselves using ordered collections in their code, since otherwise the order we read them in is not deterministic. For small maps clojure maintains source order (PersistentArrayMap). Once you get to bigger sizes it automatically switches to PersistentHashMap, and you can no longer depend on any ordering.

from deep-diff2.

esuomi avatar esuomi commented on August 17, 2024

@alysbrooks No particular situation, this was literally just a Friday thought :)

I wonder if the sorting could be applied after diffing? After all it's more of a view thing than anything.

from deep-diff2.

alysbrooks avatar alysbrooks commented on August 17, 2024

I think there are two ideas here:

  • Add support for flatland.ordered collections. This should be done in a bring-your-own-dependency fashion—we don't want to pull in this library if people aren't using it.
  • Sort. This can be probably be done by the library user but isn't straightforward since the Deletion and Insertion objects don't implement Comparable.

I think we'd welcome a PR for either.

The main reason to not accept support for flatland.ordered is that it could be a maintenance burden for a feature very few people use. On the other hand, that library appears to be very stable. We'd definitely want tests for it.

from deep-diff2.

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.