Remove misleading terms/clauses for :currency options and operands#938
Remove misleading terms/clauses for :currency options and operands#938
:currency options and operands#938Conversation
:currency options
:currency options:currency options and operands
|
You're changing the operand definition, which is not the same thing as an option value. All of our functions explicitly allow implementation defined types in the operand section. Similarly, option values covered by the text you cite (which might not be clear enough) provides permission to use a different value space (which mostly means literal values, which we caution against for good reason). The text you're eliding here permits the same implementation defined types to be used as an option value. What we're trying to permit is this: ImmutableMap<String,Object> args = ImmutableMap.of(
"currency", Currency.getInstance("USD"),
"value", 123.45
);
MessageFormatter mf2 = MessageFormatter.builder()
.setPattern("You have: {$value :currency currency=$currency}").build();
System.out.println(mf2.formatToString(args));We want Similarly, as we explicitly call out, want to be able to use a specific boxing value (here, ICU4J's ImmutableMap<String,Object> args = ImmutableMap.of(
"value", new CurrencyAmount( 123.45, Currency.getInstance("USD"))
);
MessageFormatter mf2 = MessageFormatter.builder()
.setPattern("You have: {$value :currency}").build();
System.out.println(mf2.formatToString(args)); |
|
Makes sense, I'll close this. |
We already state near the top of the document that:
So there is no need to have a separate statement for particular options saying that X must be either Y or an implementation defined value. Moreover, by calling it out on one option on a function, it makes the readers mistrust whether is actually the case for other options on the function.
Eg, "berries can be added to any desserts" at the top of the menu, then later
"desserts are pancakes (optionally with berries), or waffles".
It makes people question whether you can have waffles with berries even though you say at the top you can.