3 ms·
>But this feature is being added to Java to solve the pretty serious problem of code injection My take is that it will do little for code injection. Most progr
by coldtea 3y ago
>But this feature is being added to Java to solve the pretty serious problem of code injection
My take is that it will do little for code injection. Most programmers will use STR/FMT, and unless they offer an HTML or an SQL processor in the stdlib, they wont be used.
>Remember, string templates are most useful when what they produce is not a string, but rather construct a specific API entity
Sure, but the processor can do little short of implementing full parsing to understand the context of say HTML or SQL, right?
- pron 3y ago> Most programmers will use STR/FMT, and unless they offer an HTML or an SQL processor in the stdlib, they wont be used. New processors obviously can't be used unless they're offered by a library, but when they are, they must be used. The libraries simply won't offer an API based on strings (and, therefore, interpolated strings), or if they already do, they will be able to deprecate them. If an HTML library has no API that takes strings, then STR/FMT simply can't be used. The library can enforce the safety of its API. > Sure, but the processor can do little short of implementing full parsing to understand the context of say HTML or SQL, right? Yes, that's the point. An HTML library will offer an HTML processor, and similarly for a JSON or SQL library. I'm not apprised of the exact status, but I believe that the team specifying JDBC is looking into offering a SQL processor as part of JDBC.