Add string interpolation to Java using back-ticks similar to ECMAScript

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Add string interpolation to Java using back-ticks similar to ECMAScript

Behrang Saeedzadeh
As back-tick is not used in Java at the moment, grammar-wise this should be
relatively easy. And the parser can translate such strings to string concat
or StringBuilder calls.

A simple syntax sugar, but very sweet.

Best regards,
Behrang Saeedzadeh
Reply | Threaded
Open this post in threaded view
|

Re: Add string interpolation to Java using back-ticks similar to ECMAScript

David Holmes
Hi Behrang,

The discuss list is for discussing the actual OpenJDK Community, not for
technical suggestions or discussions. I suggest compiler-dev may be a
place to get some discussion going.

Regards,
David

On 4/09/2017 12:20 PM, Behrang Saeedzadeh wrote:
> As back-tick is not used in Java at the moment, grammar-wise this should be
> relatively easy. And the parser can translate such strings to string concat
> or StringBuilder calls.
>
> A simple syntax sugar, but very sweet.
>
> Best regards,
> Behrang Saeedzadeh
>
Reply | Threaded
Open this post in threaded view
|

Re: Add string interpolation to Java using back-ticks similar to ECMAScript

Ben Evans-4
In reply to this post by Behrang Saeedzadeh
Hi Behrang,

This topic and suggestion has been extensively discussed over the
course of several different Java releases.

Before suggesting discussing it again, I recommend that you use your
friendly neighbourhood search engine to read the discussion that has
occurred on previous occasions. I don't believe that the situation has
changed significantly since the last time this was discussed - but
perhaps you have a new, compelling reason that has not been thought of
during any of the previous discussions.

If you do have a good new reason, then I suggest that providing a
prototype patch to javac that implements this will be a good way to
get people interested in this again. If you have such a patch, then
compiler-dev is the place to post it.

Thanks,

Ben



On Mon, Sep 4, 2017 at 7:50 AM, Behrang Saeedzadeh <[hidden email]> wrote:
> As back-tick is not used in Java at the moment, grammar-wise this should be
> relatively easy. And the parser can translate such strings to string concat
> or StringBuilder calls.
>
> A simple syntax sugar, but very sweet.
>
> Best regards,
> Behrang Saeedzadeh