String Tapas Redux: Beyond mere string interpolation
John Rose
john.r.rose at oracle.com
Fri Sep 17 22:25:19 UTC 2021
On Sep 17, 2021, at 3:49 AM, Tagir Valeev <amaembo at gmail.com<mailto:amaembo at gmail.com>> wrote:
Another alternative is to have a single list of template fragments,
something like this:
Probably the VM will prefer to see a single string.
There are lots of unused Unicode points that can
serve as segment markers.
This of course only directly affects the translation
strategy, not the user-visible APIs, except the lowest
level BSM components. Condy can make up any
representational differences to List<String> or
something more exotic.
Also, languages like Scala which want to add
modifiers to interpolation points, like \{PI}%.3f,
can share add their own parsing logic to the
single long string, just as easily (or more easily)
as to a list of strings to be individually parsed.
Basically, if it’s just one long string, then you
take your domain-specific parser and make sure
it properly lexes the “object replacement marker”
provided by unicode, as well as whatever string
structure you also want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210917/d3f5a4ad/attachment-0001.htm>
More information about the amber-spec-experts
mailing list