Skip to content

Commit 4181354

Browse files
aphillipseemelimacchiati
authored
Provide normative guidance on function/option/option value impl. (#925)
* Provide normative guidance on allowing optional options, values, and functions See #924 for the origin of this PR. * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Define _accept_ and use that term * Update spec/registry.md * Update spec/registry.md Co-authored-by: Mark Davis <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Address comments around function namespacing * Address 2024-11-11 telecon comments - Define _Unsupported Operation_ error allowance - Remove mentions of the Default Registry - Convert note to text - Incorporate suggestions * Add _Unsupported Operation_ error * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/registry.md Co-authored-by: Eemeli Aro <[email protected]> --------- Co-authored-by: Eemeli Aro <[email protected]> Co-authored-by: Mark Davis <[email protected]>
1 parent 51b0d5d commit 4181354

File tree

2 files changed

+58
-15
lines changed

2 files changed

+58
-15
lines changed

spec/errors.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,9 @@ does not match the expected implementation-defined format.
382382
> horse {{The value is a horse.}}
383383
> * {{The value is not one.}}
384384
> ```
385+
386+
### Unsupported Operation
387+
388+
A **_<dfn>Unsupported Operation</dfn>_** error is an implementation-specific error
389+
that occurs when a given _option_, _option_ value, _operand_ value, or some combination
390+
of these are incompatible or not supported by a given _function_ or its _function handler_.

spec/registry.md

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,57 @@
11
# MessageFormat 2.0 Default Function Registry
22

3-
This section describes the functions for which each implementation MUST provide
4-
a _function handler_ to be conformant with this specification.
5-
6-
Implementations MAY implement additional _functions_ or additional _options_.
7-
In particular, implementations are encouraged to provide feedback on proposed
8-
_options_ and their values.
9-
10-
> [!NOTE]
11-
> The [Stability Policy](/spec#stability-policy) allows for updates to
12-
> Default Registry functions to add support for new options.
13-
> As implementations are permitted to ignore options that they do not support,
14-
> it is possible to write messages using options not defined below
15-
> which currently format with no error, but which could produce errors
16-
> when formatted with a later edition of the Default Registry.
17-
> Therefore, using options not explicitly defined here is NOT RECOMMENDED.
3+
This section defines the **standard** _functions_ which are REQUIRED for conformance with this specification,
4+
along with **optional** _functions_ that SHOULD be implemented to support
5+
additional functionality.
6+
7+
To **_<dfn>accept</dfn>_** a function means that an implementation MUST NOT
8+
emit an _Unknown Function_ error for that _function_'s _identifier_.
9+
To _accept_ an _option_ means that a _function handler_ MUST NOT
10+
emit a _Bad Option_ error for that _option_'s _identifier_ when used with the _function_
11+
it is defined for
12+
and MUST NOT emit a _Bad Option_ error for any of the _option_ values
13+
defined for that _option_.
14+
Accepting a _function_ or its _options_ does not mean that a particular output is produced.
15+
Implementations MAY emit an _Unsupported Operation_ error for _options_
16+
or _option_ values that they cannot support.
17+
18+
_Functions_ can define _options_.
19+
An _option_ can be **standard** or **optional**.
20+
21+
Implementations MUST _accept_ each **standard** _function_ and
22+
MUST _accept_ all _options_ defined as **standard** for those _functions_.
23+
24+
Implementations SHOULD _accept_ each **optional** _function_.
25+
For each such _function_, the implementation MUST accept all _options_
26+
listed as **standard** for that _function_.
27+
28+
Implementations SHOULD _accept_ _options_ that are marked as **optional**.
29+
30+
Implementations MAY _accept_ _functions_ not defined in this specification.
31+
In addition, implementations SHOULD provide mechanisms for users to
32+
register and use user-defined _functions_ and their associated _functional handlers_.
33+
Functions not defined by any version of this specification SHOULD use
34+
an implementation-defined or user-defined _namespace_.
35+
36+
Implementations MAY implement additional _options_ not defined
37+
by any version of this specification
38+
for **standard** and **optional** functions.
39+
Such _options_ MUST use an implementation-specific _namespace_.
40+
41+
Implementations MAY _accept_ additional _option_ values for _options_ defined here.
42+
However, such values might become defined with a different meaning in the future,
43+
including with a different, incompatible name
44+
or using an incompatible value space.
45+
Supporting implementation-specific _option_ values for **standard** or **optional** functions is NOT RECOMMENDED.
46+
47+
Future versions of this specification MAY define additional _options_ and _option_ values,
48+
subject to the rules in the [Stability Policy](#stability-policy),
49+
for _functions_ found in this specification.
50+
As implementations are permitted to ignore _options_ that they do not support,
51+
it is possible to write _messages_ using _options_ not defined below
52+
which currently format with no error, but which could produce errors
53+
when formatted with a later edition of this specification.
54+
Therefore, using _options_ not explicitly defined here is NOT RECOMMENDED.
1855

1956
## String Value Selection and Formatting
2057

0 commit comments

Comments
 (0)