https://www.stefanjudis.com/today-i-learned/property-order-is-predictable-in-_javascript_-objects-since-es2015/ Modern _javascript_ retains insert order of object keys
except for integer indices: these appear first in the overall object property order and are sorted numerically.
Still some way to go
From:
odata@lists.oasis-open.org <
odata@lists.oasis-open.org>
On Behalf Of Stefan Hagen
Sent: Thursday, 9 February 2023 20:53
To: Ericson, George <
George.Ericson@dell.com>; Theissen, Heiko <
heiko.theissen@sap.com>
Cc:
odata@lists.oasis-open.org Subject: Re: [odata] Reference for types of collections
Short comment from the side lines,
order is an overloaded term for many ... and hashing is hard.
Maybe not so important and even fuzzy thoughts:
- Python has ordered (insert order) collections (tuple, list) and
sets (set, frozenset, dict) built in.
- Sorted (dynamically maintained sorted order) containers are
third-party contributions for python.
- C++ std unfortunately introduces confusion by mixing up
(actively) sorted containers with (insert) ordered containers.
Esp. the abundant map is sorting by element domain attribute.
- I write this, because advocating stable insert ordering would
offer much more streamable JSON objects when the serializing
and deserializing host components could rely on containers
with insert order ... that could also spare the decorative Rococo
of embedding JSON objects inside JSON arrays only to fixate
the order not because there are no unique keys available.
- Python 3.6 introduced the stable insert order and in addition
delivered a performance boost which provided magic like
a cake we can eat and keep too.
I still hope for RFC 987654321 providing such a revised JSON.
All the best,
Stefan
On Wed, Feb 8, 2023, at 22:47, Ericson, George wrote:
Here is the reference mentioned today in our discussion on types of collections.
https://www.omg.org/spec/OCL/2.4/PDF .
See sections 11.6 and following.
My summary of the definitions from the OCL reference.
OCL
Description
collection
an aggregation of elements . If an element occurs twice in a collection, there are two elements.
set
contains elements without duplicates.
orderedset
a set, the elements of which are ordered. It contains no duplicates.
bag
a collection with duplicates allowed.
sequence
a collection where the elements are ordered.
My comparison between C++ and OCL terms.
C++
~OCL
C++ Description
container
collection
An object that stores other objects.
unordered_map
unordered_set
set
an unordered associative container that supports unique keys (an unordered_set contains at most one of each key value) and in which the elements keys are the elements themselves.
map
set
orderedset
an ordered associative container that supports unique keys (contains at most one of each key value) and provides for fast retrieval of the keys themselves.
unordered_multimap
unordered_multiset
bag
an unordered associative container that supports equivalent keys (an instance of unordered_multiset may contain multiple copies of the same key value) and in which each element s key is the element itself.
multimap
multiset
sequence
an ordered associative container that supports equivalent keys (possibly contains multiple copies of the same key value) and provides for fast retrieval of the keys themselves.
Thanks,
George
Stefan Hagen, Emmetten, Nidwalden, Switzerland.
orcid:
https://orcid.org/0000-0003-4206-892X read:
https://stefan-hagen.website write:
stefan@hagen.link