Strings and things
Brian Goetz
brian.goetz at oracle.com
Fri Sep 17 17:17:07 UTC 2021
> 1) I am wondering whether % formatting directives are common enough
> that you want to take on the work of collecting them and passing them
> to the processor. You have the power to use \% or \{...%...}, and then
> the implementor doesn't have to worry about things like %%.
We briefly considered this, but it seems too opinionated for the
language. Yes, many formatters will happily use %stuff\{filler}, but
there are also domains where this is not such a good answer, and this
seems a poor thing for the language to be opinionated about.
> 2) I've always found it irksome that MessageFormat has a large overlap
> with String.format, but it uses its own ad-hoc syntax:
>
> String pattern
> = "{0} zerstörte am {2,date,long} {1,choice,0#kein Haus|1#ein
> Haus|2#{1} Häuser}";
>
> I haven't spent any thought on how to unify that with interpolation,
> but I thought I'd throw it out there.
I think this is unavoidable. People will write substitution processors
for all sorts of things. Let's give them the plumbing to make that
easier for libraries and clients, but it seems an impossible task to try
to get them to all agree on a style.
More information about the amber-dev
mailing list