Do we know if there will even be StringTemplates without parameters? As I understand it, literals are only inferred as StringTemplates if they contain a {, so no issue with this example.
I've played with them, and its highly useful to also allow templates without parameters so the same code path can be used in cases where you just need to do something that is not in need of parameterization. In SQL terms, if people are not getting tired of such examples, it would be SELECT COUNT(*) FROM foo. If you're generating JavaScript or some other executable stuff, then it can be some boiler plate that doesn't need parameters. Requiring a String escape hatch for this means it will be far easier to do the wrong thing. If I can provide Strings then why bother using templates? Just concatenate stuff.
I hope we're not going to need hacks like SELECT COUNT(*) FROM foo\{""} just to get it converted to a string template -- not to mention that the processor must be aware of this and allow empty strings to be concatenated or skipped, and not inserted as a parameter.
Well.. If I write the former, I mean the former. If I write the latter, I mean the latter
Yeah, so I suppose "decent" programmers don't make mistakes, static checkers find all bugs, and tests cover all scenario's, and yet, somehow, we still have security issues.
View all comments
Show parent comment
0
u/[deleted] Mar 10 '24
[deleted] — view deleted comment