Re:Java 21 Released
by paulddraper on Tuesday September 19, 2023 @10:57AM
(#37570832)
...at what cost tho
[ Parent
| on HN ]
Re:Java 21 Released
by capableweb on Tuesday September 19, 2023 @11:32AM
(#37571398)
The JEP makes it kind of clear:
> trading off a small amount of convenience to gain a large amount of safety
Re:Java 21 Released
by paulddraper on Tuesday September 19, 2023 @11:50AM
(#37571716)
*large
*small
You can create json and sql string template processors that suffer from no injection problems. I'd call that a large improvement over, for example, Javascript. But I'm not familiar enough with the string template feature in the other languages to comment on their relative security.
Re:Java 21 Released
by paulddraper on Tuesday September 19, 2023 @01:08PM
(#37572978)
> You can create json and sql string template processors that suffer from no injection problems. I'd call that a large improvement over, for example, Javascript.
Bad example. JavaScript literally has that. [1]
function sql(strings, ...args) {
// ...
}
sql`SELECT * FROM user WHERE email = $1`
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:Java 21 Released
by 5e92cb50239222b on Tuesday September 19, 2023 @01:01PM
(#37572873)
This is a solved problem in .NET, and C# only has one kind of string templating:
FormattableString foo = $"select * from {table} where {column} = 42";
https://learn.microsoft.com/en-us/ef/core/querying/sql-queri...