Are templated string embedded expressions "method parameters" or "lambdas"?

Guy Steele guy.steele at oracle.com
Sat Oct 30 21:13:08 UTC 2021



On Oct 29, 2021, at 10:10 AM, Jim Laskey <james.laskey at oracle.com<mailto:james.laskey at oracle.com>> wrote:

For our early templated string prototypes, we restricted embedded expressions to just basic accessors and basic arithmetic. The intent was to keep things easy to read and to prevent side effects. Over time, we began thinking this restriction was unduly harsh. More precisely, we worried it that it would result in a complex, difficult-to-defend boundary. But we still would like users to not rely on side-effects.

Consequently, a new proposal for embedded expressions - we would allow any Java expression with the restriction that you can't use single quotes, double quotes or escape sequences. We opted to keep this restriction to allow tools (ex., syntax highlighters) to isolate embedded expressions within strings without requiring sophisticated parsing.

An interesting restriction. Would comments also be forbidden within such expressions (for the same reason)?

—Guy


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20211030/3183d36e/attachment-0001.htm>


More information about the amber-spec-experts mailing list