unicode-org / message-format-wg

Developing a standard for localizable message strings
Other
209 stars 32 forks source link

Unify input and local declarations in data model #799

Open eemeli opened 1 month ago

eemeli commented 1 month ago

Closes #786

This change is a part of what was discussed in #718, i.e. the part that didn't get any critique in the issue.

In the syntax, keeping .input and .local as separate operations makes really good sense from a readability point of view. In the data model, as those concerns are not present, there is no reason to keep the separate type: 'input' and type: 'local' blocks. Both will almost certainly be processed the same way, and the input/local-ness can be inferred when necessary by

type = value.arg?.type == 'variable' && value.arg.name == name ? 'input' : 'local'

This also drops the need for a VariableExpression, which simplifies the TS & JSON Schema definitions quite a bit.