String template always requiring a processor
Guy Steele
guy.steele at oracle.com
Thu Oct 27 19:35:49 UTC 2022
I agree that, because one can always use the RAW processor (which simply passes back the string template itself), always requiring a processor syntactically seems like a good way to go.
—Guy
> On Oct 27, 2022, at 3:19 PM, Jim Laskey <james.laskey at oracle.com> wrote:
>
> We’ve been having a rethink after recent concerns expressed by several experts over the current string template design leading beginners down the path only to stubble over "string templates are not strings”. Our original view was that users would soon learn to insert the STR, but after consideration, having the surprise hit them at runtime is not a compelling selling point.
>
> Consequently, we are changing things up to follow Tagir’s suggestion of always requiring a processor; i.e., no naked StringTemplates. As a result, IDEs can flag the problem when editing or have inspection insert the STR automatically. For most users, STR would have been used anyway. So, this change really only affects those requiring the unprocessed string template (me and one or two other people). In those cases, users can use the RAW processor.
>
> Making it easier for IDEs to detect and correct will help mute the grumbling about naked StringTemplates not being string interpolation. As stated in the JEP, making Java safe and secure is the goal. This is the way.
>
> Cheers,
>
> — Jim
>
More information about the amber-spec-observers
mailing list