-
-
Notifications
You must be signed in to change notification settings - Fork 36
Review data model #651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review data model #651
Conversation
Addresses issue #639 I will also update the .json and .dtd, but after we get an agreement on this.
|
I don't consider it 100% done, but it is the result of a first (slow and careful) pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this.
The top part looks like it needs more work. Other parts looks like they might be in better harmony with the syntax. I didn't comment fully.
| A `SimpleMessage` corresponds to a syntax message that includes _selectors_. | ||
| A message without _selectors_ and with a single _pattern_ is represented by a `ComplexMessage`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is backwards.
| A `SimpleMessage` corresponds to a syntax message that includes _selectors_. | |
| A message without _selectors_ and with a single _pattern_ is represented by a `ComplexMessage`. | |
| A `SimpleMessage` is a _message_ without _selectors_ and with a single _pattern_. | |
| A `ComplexMessage` is any _message_ that includes one or more _declarations_, a _selector_, or both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the changes proposed here bring the data model much closer to the MF2 syntax, they also make it less useful for any other purpose. None of the proposed changes are presented with any discussion about why they are being made, and they are sufficiently extensive that I would expect a design document discussing them, should we wish to consider their incorporation in the spec.
In short, this does not appear to be a review of the data model, but a rewriting of it. I do not think that can be in scope for our consideration this week.
|
|
||
| ```ts | ||
| type Message = PatternMessage | SelectMessage; | ||
| type Message = SimpleMessage | ComplexMessage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change in representation? This seems wholly unnecessary, as it links the data model with syntactic details like the representation of a message with a single pattern depending on whether it starts with a . or not.
I would have expected a change like this to have at least some argumentation about why it's being made, and some consideration of how it's impacting data model users and operations.
| An `UnsupportedStatement` represents a statement not supported by the implementation. | ||
| An `ReservedStatement` represents a statement not supported by the implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this rename? Again, I would expect some argumentation here.
| value?: string; | ||
| value: Pattern; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a misunderstanding of this data model entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically: I think it should be string because the intention here is for it to be a different string representing the catchall key in some syntax other than MF2. And it should be optional.
|
|
||
| In the syntax, | ||
| a `PatternMessage` may be represented either as a _simple message_ or as a _complex message_, | ||
| a `ComplexMessage` may be represented either as a _simple message_ or as a _complex message_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's confusing to use "complex" to mean two different things (in the data model, having only a single pattern, regardless of declarations; in the concrete syntax, having no declarations and no selectors.)
I don't love the terms PatternMessage and SelectMessage, but I agree with Eemeli that it's probably best to keep it that way.
|
|
||
| interface ComplexMessage { | ||
| type: "complex-message"; | ||
| declarations?: Declaration[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be declarations: Declaration[] per #633
| with its _expression_ `value`. | ||
| The `name` does not include the initial `$` of the _variable_. | ||
| The `name` does not include the `$` sigil of the _variable_, | ||
| or the starting and ending `|` of the literals. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about this -- since this part is describing what appears on the left-hand side of a declaration, where do literals come in?
| the `keys` and `value` of each _variant_ are represented as an array of `Variant`. | ||
| For the `CatchallKey`, a string `value` may be provided to retain an identifier. | ||
| This is always `'*'` in MessageFormat 2 syntax, but may vary in other formats. | ||
| In a `Matcher` the `keys` and `value` of each _variant_ are represented as an array of `Variant`. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In a `Matcher` the `keys` and `value` of each _variant_ are represented as an array of `Variant`. \ | |
| In a `Matcher`, | |
| the `keys` and `value` of each _variant_ are represented as an array of `Variant`. |
(Use semantic line breaks; remove stray backslash)
| value?: string; | ||
| value: Pattern; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically: I think it should be string because the intention here is for it to be a different string representing the catchall key in some syntax other than MF2. And it should be optional.
| Each element of the `Pattern` MUST either be a non-empty string, an `Expression`, or a `Markup` object. | ||
| String values represent literal _text_. | ||
| Each element of the `Pattern` MUST either be a non-empty string, an `Expression`, | ||
| or a `Markup` object. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| or a `Markup` object. \ | |
| or a `Markup`. |
Delete "object" for consistency with the rest of the sentence (it doesn't say "an Expression object").
And, I don't think the backslashes are necessary? (Here and elsewhere.)
| `Literal` represents all literal values, both numeric (_unquoted_) and string (_quoted_). | ||
| The presence or absence of quotes (`'|'` in MessageFormat 2) is not preserved by the data model. | ||
| The `value` of `StringLiteral` is the "cooked" value (i.e. escape sequences are processed). | ||
| The `value` of `NumberLiteral` is the numeric value after parsing (for example the trailing zeros are not preserved). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `value` of `NumberLiteral` is the numeric value after parsing (for example the trailing zeros are not preserved). | |
| The `value` of `NumberLiteral` is the numeric value after parsing, | |
| (for example the trailing zeros are not preserved). |
Use semantic line breaks.
More substantively: making this the "parsed" numeric value makes it hard to test the roundtrip property (maybe I missed an issue where this was discussed?)
| and are guaranteed to not be in conflict with future standard development. | ||
|
|
||
| An `ReservedAnnotation` represents a _reserved annotation_. | ||
| not supported by the implementations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| not supported by the implementations. | |
| not supported by the implementation. |
(Consistency with the previous para)
|
|
||
| An `ReservedAnnotation` represents a _reserved annotation_. | ||
| not supported by the implementations. | ||
| These are annotations that might be defined in the future version of the standars. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| These are annotations that might be defined in the future version of the standars. | |
| These are annotations that might be defined in the future version of the standard. |
| An `Identifier` is used to identify functions, options, attributes, markup, | ||
| and supporting namespaces to avoid conflict between various proprietary extensions. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| An `Identifier` is used to identify functions, options, attributes, markup, | |
| and supporting namespaces to avoid conflict between various proprietary extensions. \ | |
| An `Identifier` is used to identify functions, options, attributes, and markup. | |
| It also includes a namespace, to avoid conflict between various proprietary extensions. |
|
Propose we move this post-tech preview. |
Addresses issue #639
I will also update the .json and .dtd, but after we get an agreement on this.