3 ms·
> Sadly, true. Why is the template processor named `STR`, why not `f"String"`, like Python? It looks like the prefix is pluggable so you can use different temp
by masklinn 3y ago
> Sadly, true. Why is the template processor named `STR`, why not `f"String"`, like Python?
It looks like the prefix is pluggable so you can use different template processors, STR is just the default:
> STR is a template processor defined in the Java Platform. It performs string interpolation by replacing each embedded expression in the template with the (stringified) value of that expression.
> FMT is another template processor defined in the Java Platform. FMT is like STR in that it performs interpolation, but it also interprets format specifiers which appear to the left of embedded expressions.
> Developers can easily create template processors for use in template expressions.
This is similar to Javascript's `tagged templates`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe.... Python's f-strings are very much lacking that.
Although I do agree that the syntax, both of the prefix and the interpolation symbol, is awful.