Giter Club home page Giter Club logo

Comments (1)

moul avatar moul commented on June 6, 2024 1

Golang's team intentionally made it random, starting with Go 1, to make developers not rely on it.
See https://go.dev/blog/maps.

Protobuf also specifies that they have fewer guarantees and implements them as slices of structs on the wire.

And on a side note, some web2 CTO friends added linters to prevent their teams from using maps. Even in web2, indeterministic maps were too confusing with flappy unit tests or bugs discovered in production. They told me that maps are generally deficient in performance, not only in go. But please, keep this comment as a hint and not a fact.


My current feeling:

  • We should not deny them thoroughly (I hope we can one day find a technical and legal way to convert and import web2 libraries that make sense).
  • We should make them determinist.
  • We should/could deny them from being used as global values, function parameters, or returned values. So they can only be used for some patterns and inside functions, i.e., removing duplicates from a slice.
  • we should create better structures like p/avl.Tree and p/avl.MutTree to have easy-to-use data structs optimized for chains.
  • If we deny maps completely, we can suggest alternative approaches like []struct{Key:..., Value:...}, which is the most common approach for other languages not having map support or looking for more excellent compatibility.

from gno.

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.