[HN Gopher] JEP Draft: String Templates (Final)
___________________________________________________________________
JEP Draft: String Templates (Final)
Author : mfiguiere
Score : 14 points
Date : 2023-09-25 18:38 UTC (4 hours ago)
(HTM) web link (openjdk.org)
(TXT) w3m dump (openjdk.org)
| rf15 wrote:
| Even after reading this proposal over the past months over and
| over in all its iterations, I still don't get it. Is this what
| many developers want? I fear people will just stick with
| +concatenation because it's less verbose than this.
| hn_throwaway_99 wrote:
| It's nice that they implemented string templates essentially
| exactly the same way Javascript template literals and tag
| functions work. They even give an example of using it to create a
| prepared statement (e.g. DB."SELECT * FROM foo WHERE bar =
| \\{inputParam}") which is exactly what many NodeJS libraries due,
| e.g. Slonik https://github.com/gajus/slonik, like sql`SELECT *
| FROM foo WHERE bar = ${inputParam}`;
| maxloh wrote:
| Not quite. Dedenting template literal is a pain in the ass,
| which should have been supported from day one.
|
| The TC39 committee actually come up with an additional proposal
| for that use case.
| mfiguiere wrote:
| > Feedback from JDK 21 suggested that String Templates should be
| finalized for JDK 22.
| jiehong wrote:
| Would be nice if they detailed the received feedback.
___________________________________________________________________
(page generated 2023-09-25 23:02 UTC)