Skip to content

Ordered Maps: maps that retain insertion order #1651

@ChristianGruen

Description

@ChristianGruen

Currently, XDM maps are “unordered”: An implementation is allowed to organize entries in a way that optimizes lookup, not order. The entries do not have a predictable order unless they are explicitly sorted.

There are cases in which it is helpful if the “insertion order” is preserved – i.e., the order in which new map entries are added to a map. While the insertion order is not relevant if a map is exclusively used for lookups, it may be beneficial if the input includes deliberately sorted key/value pairs, such as (often) in JSON data, configurations or key/value sequences.

I created this issue because there was some confusion in #564, and on Slack, about this map flavor and “sorted maps”, which are discussed in issue #564: Sorted maps hold all map entries sorted by the key, using a comparator or (in its basic variant) fn:data#1.

PR #1609 attempts to solve both requirements at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureA change that introduces a new featurePR PendingA PR has been raised to resolve this issueXDMAn issue related to the XPath Data ModelXPathAn issue related to XPathXQFOAn issue related to Functions and Operators

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions