References to runtime values and attributes #209
Labels
blocker-candidate
The submitter thinks this might be a block for the next release
data model
Issues related to the Interchange Data Model
functions
Issue pertains to the default function set
resolve-candidate
This issue appears to have been answered or resolved, and may be closed soon.
Stale
Obsolete?
Is your feature request related to a problem? Please describe.
With select messages, the case often arises that it's desirable for the selector value (in particular a number) to also be used within a select message, or for the selection to be made based on some attribute of a value that would then be used within the formatted message.
In MF1, the first of these is enabled by using
#
within a plural or selectordinal. In #52 (comment), @zbraniecki gives an example of the latter. This is also raised in #31 by @grhoten.Describe the solution you'd like
We should determine how we can avoid error-prone duplication in MF2, so that e.g. numbers in select messages get formatted with the same options with which their cases were selected, and custom functions do not need to be called multiple times with the same arguments.
One option here is to e.g. include something like
#
in the MF2 data model, and to ensure that custom functions are pure, so that their results may be memoised for later calls with the same parameters.Another option would be to introduce something like message-specific "macros" or "phrases" that have been suggested by @mihnita and @stasm in conversation elsewhere. The idea is to provide essentially a set of local variables that a message may use in its contents, with their values determined at runtime. This would be the solution that I'd prefer.
Describe why your solution should shape the standard
If such local variables are made available, they'll need a way to be defined in the syntax, as well as have a place in the data model. Using a made-up pseudosyntax, it might look something like this:
The text was updated successfully, but these errors were encountered: