Skip to content

Conversation

@eemeli
Copy link
Collaborator

@eemeli eemeli commented May 22, 2024

Closes #716

As discussed in the parent issue and its other follow-up #751, the order of options and attributes should not matter for their formatting or other processing. Reflecting this in the data model by making these use a mapping makes it clearer that e.g. {:foo one=13 two=42} and {:foo two=42 one=13} should be considered equivalent.

Note, though, that the order isn't completely lost here. The TS data model uses an ordered Map for these, and numerous JSON processors provide guarantees about retaining the order, even though the JSON spec does not require that. So making this change does not in practice make it harder for message syntax serialisers to retain the order that options or attributes may have had originally.

@eemeli eemeli added the data model Issues related to the Interchange Data Model label May 22, 2024
Copy link
Member

@aphillips aphillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start. I think this is the right direction.

@eemeli eemeli requested a review from aphillips May 22, 2024 14:43
@catamorphism
Copy link
Collaborator

As part of this change, I think it would be useful to change https://github.com/unicode-org/message-format-wg/blob/main/spec/errors.md to add a new category of errors. I'm not sure what it would be called, but it seems weird to call "duplicate option name" a data model error if messages that have this error are unrepresentable in the data model. When I read "data model error" I imagine a property that can be violated by a data model. I think it would be useful to define a category of errors that aren't syntax errors, but that have to be checked before constructing a data model.

@aphillips aphillips merged commit d18721a into main Jun 3, 2024
@aphillips aphillips deleted the options-map branch June 3, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data model Issues related to the Interchange Data Model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEEDBACK] The data model could be simplified for options and attributes

4 participants