On Tue, 22 Nov 2022 20:17:41 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

>> src/java.base/share/classes/java/util/FormatProcessor.java line 64:
>> 
>>> 62:  *
>>> 63:  * @implSpec Since, values are found within the string template, 
>>> argument indexing
>>> 64:  * specifiers are unsupported.
>> 
>> What is the behavior of a format that references an index?  Ignored, throw?
>> I can see an argument for simplicity, but the values are a sequential list 
>> similar to that of a varargs call to format("xx", x, y, z, ...) so it can be 
>> well defined to what value an index in the format refers.
>
> Kind of blows the whole concept of embedded expressions. This is one of 
> those, just because you can, doesn't mean you should.

ok, still what is the behavior if the format includes an index?
The pattern scanner in FormatProcessor permits an index and does not cause an 
error.

Also, there might be a small benefit to using the existing compiled pattern in 
Formatter.java.  (make it package private and rename to uppercase).

-------------

PR: https://git.openjdk.org/jdk/pull/10889

Reply via email to