Giter Site home page Giter Site logo

Is map type unordered? about resp3 HOT 2 CLOSED

kaey avatar kaey commented on August 18, 2024
Is map type unordered?

from resp3.

Comments (2)

AngusP avatar AngusP commented on August 18, 2024 2

Maps represent a sequence of field-value items, basically what we could call a dictionary data structure, or in other terms, an hash.

The theoretical datastructure 'hash' and 'dictionary' are unordered - of course some implementations do have orderings fall-out as a side-effect (insert order, usually).

I think there should be no guarantee of order made by RESP3, as this would require Redis or any other implementer of RESP3 to always return the same ordering for a map and make implementing a client tricky in a language where the 'logical' native map type to return is not ordered (for example, Go maps, Python 2 dicts) - you would either depend on a non-standard library that provides an ordered map, or ditch the ordering and return your native unordered type.

from resp3.

dumblob avatar dumblob commented on August 18, 2024

Just a nit pick:

Ordered hash maps would complicate implementation for some languages, like go(map) or python(dict).

Python 3 dict is ordered. For Go (as well as any other at least a bit widespread language) there is always an ordered map module - see e.g. https://github.com/iancoleman/orderedmap .

from resp3.

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.