Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Drop references to a "function registry" #983

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

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ At a minimum, it includes:
defining variable values that are available during _variable resolution_.
This is often determined by a user-provided argument of a formatting function call.

- The _function registry_,
providing the _function handlers_ of the functions referred to by _message_ _functions_.
- A mapping of string identifiers to the _function handlers_
that are available during _function resolution_.

- Optionally, a fallback string to use for the _message_ if it is not _valid_.

Expand Down Expand Up @@ -290,8 +290,8 @@ the following steps are taken:
emit an _Unknown Function_ error
and return a _fallback value_ as the _resolved value_ of the _expression_.

Implementations are not required to implement _namespaces_ or installable
_function registries_.
Implementations are not required to implement _namespaces_ or
support _functions_ other than the _default functions_.

3. Perform _option resolution_.

Expand Down
26 changes: 13 additions & 13 deletions spec/functions/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MessageFormat 2.0 Default Function Registry
# MessageFormat 2.0 Default Functions

## Table of Contents

Expand All @@ -18,8 +18,9 @@

## Introduction

This section defines the **REQUIRED** _functions_ which are REQUIRED for conformance with this specification,
along with **RECOMMENDED** _functions_ that SHOULD be implemented to support
This section defines the **_<dfn>default functions</dfn>_**
which are REQUIRED for conformance with this specification,
along with _default functions_ that SHOULD be implemented to support
additional functionality.

To **_<dfn>accept</dfn>_** a function means that an implementation MUST NOT
Expand All @@ -34,34 +35,33 @@ Implementations MAY emit an _Unsupported Operation_ error for _options_
or _option_ values that they cannot support.

_Functions_ can define _options_.
An _option_ can be **REQUIRED** or **RECOMMENDED**.
An _option_ can be REQUIRED or RECOMMENDED.
Copy link
Member

Choose a reason for hiding this comment

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

The formatting here is intentional. Many such below. Won't repeat.


Implementations MUST _accept_ each **REQUIRED** _function_ and
MUST _accept_ all _options_ defined as **REQUIRED** for those _functions_.
Implementations MUST _accept_ each REQUIRED _default function_ and
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't make this change: I don't think it is necessary.

MUST _accept_ all _options_ defined as REQUIRED for those _functions_.

Implementations SHOULD _accept_ each **RECOMMENDED** _function_.
Implementations SHOULD _accept_ each RECOMMENDED _default function_.
For each such _function_, the implementation MUST accept all _options_
listed as **REQUIRED** for that _function_.
listed as REQUIRED for that _function_.

Implementations SHOULD _accept_ _options_ that are marked as **RECOMMENDED**.
Implementations SHOULD _accept_ _options_ that are marked as RECOMMENDED.

Implementations MAY _accept_ _functions_ not defined in this specification.
In addition, implementations SHOULD provide mechanisms for users to
register and use user-defined _functions_ and their associated _functional handlers_.
register and use user-defined _functions_ and their associated _function handlers_.
Functions not defined by any version of this specification SHOULD use
an implementation-defined or user-defined _namespace_.

Implementations MAY implement additional _options_ not defined
by any version of this specification
for **REQUIRED** and **RECOMMENDED** functions.
by any version of this specification for _default functions_.
Such _options_ MUST use an implementation-specific _namespace_.

Implementations MAY _accept_, for _options_ defined in this specification,
_option_ values which are not defined in this specification.
However, such values might become defined with a different meaning in the future,
including with a different, incompatible name
or using an incompatible value space.
Supporting implementation-specific _option_ values for **REQUIRED** or **RECOMMENDED** functions is NOT RECOMMENDED.
Supporting implementation-specific _option_ values for _default functions_ is NOT RECOMMENDED.

Implementations MAY _accept_, for _operands_ or _options_ defined in this specification,
values with implementation-defined types.
Expand Down
2 changes: 1 addition & 1 deletion spec/functions/datetime.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Date and Time Value Formatting

This subsection describes the functions and options for date/time formatting.
Selection based on date and time values is not required in this release.
Selection based on date and time values is NOT REQUIRED in this release.

> [!NOTE]
> Selection based on date/time types is not required by MF2.
Expand Down
15 changes: 7 additions & 8 deletions spec/functions/number.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the value of other options, or both.
> [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options)
> in JavaScript's `Intl.NumberFormat`.

The following options and their values are required to be available on the function `:number`:
The following options and their values are REQUIRED to be available on the function `:number`:

- `select`
- `plural` (default; see [Default Value of `select` Option](#default-value-of-select-option) below)
Expand Down Expand Up @@ -126,8 +126,7 @@ the value of other options, or both.
> [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options)
> in JavaScript's `Intl.NumberFormat`.

The following options and their values are required in the default registry to be available on the
function `:integer`:
The following options and their values are REQUIRED to be available on the function `:integer`:

- `select`
- `plural` (default; see [Default Value of `select` Option](#default-value-of-select-option) below)
Expand Down Expand Up @@ -205,8 +204,7 @@ The options on `:math` are exclusive with each other,
and exactly one option is always required.
The options do not have default values.

The following options and their values are
required in the default registry to be available on the function `:math`:
The following options and their values are REQUIRED to be available on the function `:math`:

- `add`
- ([digit size option](#digit-size-options))
Expand Down Expand Up @@ -352,7 +350,7 @@ Some implementations might not be able to produce all of these formats for every
> [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options)
> in JavaScript's `Intl.NumberFormat`.

The following options and their values are required to be available on the function `:currency`:
The following options and their values are REQUIRED to be available on the function `:currency`:

- `currency`
- well-formed [Unicode Currency Identifier](https://unicode.org/reports/tr35/tr35.html#UnicodeCurrencyIdentifier)
Expand Down Expand Up @@ -435,7 +433,7 @@ together with the resolved options' values.
### The `:unit` function

The _function_ `:unit` is **Proposed** for inclusion in the next release of this specification but has not yet been finalized.
The _function_ `:unit` is proposed to be a **RECOMMENDED** formatter for unitized values,
The _function_ `:unit` is proposed to be a RECOMMENDED formatter for unitized values,
that is, for numeric values associated with a unit of measurement.
This is a specialized form of numeric formatting.

Expand Down Expand Up @@ -481,7 +479,8 @@ In general, the default values for such _options_ depend on the locale,
the unit,
the value of other _options_, or all of these.

The following options and their values are required to be available on the function `:unit`:
The following options and their values are REQUIRED to be available on the function `:unit`,
unless otherwise indicated:

- `unit`
- valid [Unit Identifier](https://www.unicode.org/reports/tr35/tr35-general.html#unit-identifiers)
Expand Down
8 changes: 4 additions & 4 deletions spec/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
1. [`message.abnf`](message.abnf)
1. [Formatting](formatting.md)
1. [Errors](errors.md)
1. [Default Function Registry](functions/README.md)
1. [Default Functions](functions/README.md)
1. [`u:` Namespace](u-namespace.md)
1. [Interchange data model](data-model/README.md)
1. [Appendices](appendices.md)
Expand Down Expand Up @@ -95,10 +95,10 @@ that previously did not specify a _fallback value_.
Updates to this specification will not change the syntactical meaning
of any syntax defined in this specification.

Updates to this specification will not remove any _functions_ defined in the default function registry.
Updates to this specification will not remove any _default functions_.

Updates to this specification will not remove any _options_ or _option_ values
defined in the default function registry.
defined for _default functions_.

> [!NOTE]
> The foregoing policies are _not_ a guarantee that the results of formatting will never change.
Expand Down Expand Up @@ -137,7 +137,7 @@ based on this version being invalid.
> - Future versions may add additional structure or meaning to existing syntax.
> - Future versions may define new _keywords_.
> - Future versions may make previously invalid _messages_ valid.
> - Future versions may define additional _functions_ in the default registry
> - Future versions may define additional _default functions_.
> or may reserve the names of _functions_ for the purposes of interoperability.
> - Future versions may define additional _options_ to existing functions.
> - Future versions may define additional _option_ values for existing _options_.
Expand Down
14 changes: 6 additions & 8 deletions spec/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,12 @@ values during formatting.
A _function_ can appear in an _expression_ by itself or following a single _operand_.
When following an _operand_, the _operand_ serves as input to the _function_.

Each _function_ is defined by the runtime's _function registry_.
A _function_'s entry in the _function registry_ will define
whether the _function_ is a _selector_ or formatter (or both),
whether an _operand_ is required,
what form the values of an _operand_ can take,
what _options_ and _option_ values are acceptable,
and what outputs might result.
See [function registry](./functions/README.md) for more information.
The resolution of a _function_ relies on an implementation-defined _function handler_.
Some _functions_ can be used both as a _selector_ as well as in a _placeholder_;
others are only valid in one of these positions.
_Functions_ also differ in their requirements on the _operand_ and _options_ that they accept.
See [Function Resolution](./spec/formatting.md#function-resolution)
and [Default Functions](./spec/functions/README.md) for more information.

A _function_ starts with a prefix sigil `:` followed by an _identifier_.
The _identifier_ MAY be followed by one or more _options_.
Expand Down