Raw String Literal Library Support
John Rose
john.r.rose at oracle.com
Wed Mar 14 15:25:32 UTC 2018
On Mar 14, 2018, at 6:11 AM, Peter Levart <peter.levart at gmail.com> wrote:
>
> Pattern.compile(string)
>
> Now if 'string' above is a constant, '~ string' could be a constant too. Combined with raw string literals, Pattern constants could be very compact.
>
>
> What do you think?
There's no need to introduce syntax in order to gain constant folding.
It's enough to ensure that Pattern.compiler(constant) reduces to
the ldc of a dynamic constant. We are experimenting on such
ideas here:
http://hg.openjdk.java.net/amber/amber/shortlog/condy-folding <http://hg.openjdk.java.net/amber/amber/shortlog/condy-folding>
(This is very vaguely similar to constexpr in C++, but less static.
It's early days, but enough to show that syntax isn't necessary.)
— John
More information about the core-libs-dev
mailing list