Code Monkey home page Code Monkey logo

Comments (11)

marcglasberg avatar marcglasberg commented on September 22, 2024 1

The same method seems wrong at first glance. Here's what it needs to do:

same will return true only if the lists internals are the same instances (comparing by identity). This will be fast even for very large lists, since it doesn't compare each item. Note: This is not the same as identical(list1, list2) since it doesn't compare the lists themselves, but their internal state. Comparing the internal state is better, because it will return true more often.

This means that IList.empty().same(IList.empty()) should return true, but I'm not sure it does. Could you please add this test and fix this? Thanks.

from fast_immutable_collections.

marcglasberg avatar marcglasberg commented on September 22, 2024 1

No problem. This package is very complex, as you probably noticed. The best way to guarantee everything works is adding as many tests as you can. Don't worry if some tests are redundant, just add as many as you think are necessary for you to feel confident it's working.

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

I started to implement some tests, so that it wont happen again. Please let me know if I forgot to test something @marcglasberg

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

I've just tried the proposed solution in the flutter app where i initially discovered the error. With the IListEmpty type everything is working as expected

from fast_immutable_collections.

marcglasberg avatar marcglasberg commented on September 22, 2024

Also, won't you also have to do this for ISet.empty() and iMap.empty() ?

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

Yes of course, i just wanted to propose my solution to you first before continuing

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

I've addeded the test and the fix in this commit: f5cc545
Will do the other collections now

from fast_immutable_collections.

marcglasberg avatar marcglasberg commented on September 22, 2024

I think you are missing the point of the same method. It's supposed to compare the internals. But don't worry, I will fix this later after I merge the PR.

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

Yes that is probably true, i have no idea what comparing the internals should look like on a empty type where there is no real internal list.

from fast_immutable_collections.

LowLevelSubmarine avatar LowLevelSubmarine commented on September 22, 2024

Fixed with #76

from fast_immutable_collections.

marcglasberg avatar marcglasberg commented on September 22, 2024

I've just improved the same method and published a new version to pub.dev.

from fast_immutable_collections.

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.