Skip to content

Order of map is nondeterministic, making read+write randomize the file #1909

@rakudrama

Description

@rakudrama

The use of a HashMap here https://github.com/dart-lang/yaml/blob/master/lib/src/equality.dart#L13
ensures that when the elements of a map are added here https://github.com/dart-lang/yaml/blob/master/lib/src/loader.dart#L156
the order is nondeterministic.

This shows itself in tools that read then write yaml - the output is needlessly reorganized.

The default behaviour should keep the input order (change HashMap to LinkedHashMap)

Sorting would be a nice option, but keeping the original order would

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions