w3c / rdf-concepts

https://w3c.github.io/rdf-concepts/
Other
17 stars 2 forks source link

base JSON value objects on unordered maps #88

Closed pfps closed 1 week ago

pfps commented 5 months ago

The value space still contains orderd maps (with insignicant order). It would be much better to start out with a map datatype that is unordered instead of going through all the contortions to try to eliminate all vestiges of the order.

https://en.wikipedia.org/wiki/Associative_array appears to be a reasonable reference for an unordered finite map.

gkellogg commented 5 months ago

As I've said elsewhere, we use INFRA (to the degree possible) for describing our values. INFRA is used in many W3C specs typically for representing that values associated with JSON strings. It would be unusual for our value space to use everything from INFRA except (ordered) map. Practically speaking, when parsing a JSON Object, implementations will construct the map in sequence, and there are cases where preserving this order is useful. But, the JSON model is that map entries are unordered, which really only becomes significant when comparing two maps, which we provide for. Maps are accessed by key, so ordinal location of a map entry within a map is not important.

My opinion remains that we should continue to use the INFRA map definition.

pfps commented 5 months ago

OK, but then you are responsible for ensuring that all the messiness of using an ordered map is handled. I have provided an alternative that requires fewer complications.