toml icon indicating copy to clipboard operation
toml copied to clipboard

Dotted key ordering isn't always preserved

Open epage opened this issue 3 years ago • 7 comments

hello.world = "a"
goodbye = "b"
hello.moon = "c"

gets turned into

hello.world = "a"
hello.moon = "c"
goodbye = "b"

epage avatar Sep 03 '21 15:09 epage

If/when we add position information, a next step is to see if we can infer an inserted values position based on the parent dotted table. This would have us automatically organize new keys as is encouraged in the TOML spec

epage avatar Sep 03 '21 18:09 epage

Has there been any progress on this?

ofek avatar Nov 18 '23 06:11 ofek

Generally, if there were, they'd already be posted here or in a linked issue

Overall, the use of dotted keys seems small and alt ordering being even smaller as its non-idiomatic, that this hasn't been a priority for me. If someone else wants to pick up the work, they are welcome to.

epage avatar Nov 18 '23 12:11 epage

Thanks, I was just curious as I'm thinking about making Python bindings.

ofek avatar Nov 18 '23 17:11 ofek

Hi! Drive by question: What/where is the struct or tree holding the collection of values dotted and otherwise and how can we make that type and its underlying values types "sort" in insertion order?

fenollp avatar Mar 11 '24 00:03 fenollp

As this is isn't a focus area / priority of mine, it will be up to you to do some leg work on investigating this.

epage avatar Mar 11 '24 14:03 epage