▲ | pphysch 8 days ago | ||||||||||||||||
You don't have to add HTML validation to your processing func, but you brought up invalid syntax up as an issue with string templating. > The whole thing is wrongheaded; exactly the kind of stove-pipe people end up inventing when they don't have metaprogramming. Python has many metaprogramming features. I don't think you understand this feature much less its motivation. How else would you go about adding language support for e.g. HTML and SQL within Python? | |||||||||||||||||
▲ | kazinator 8 days ago | parent [-] | ||||||||||||||||
On the contrary, I implemented a substantial facsimile of it in a Lisp dialect yesterday; see my comment history.
Unlike template strings, it was done in the language. There already are quasi-strings in the form of `...` syntax. We can quote that syntax (e.g. implicitly as a macro argument) and then pull apart its pieces to construct an object. It should work even in a years-out-of-date installation of the language. No new tooling is required; no changes to syntax highlighting in the editor, nothing.It's a parlor trick that doesn't have any uses. The structured log messages use case is the most promising, because it has a consumer which actually wants the interpolated pieces that it would otherwise have to hackily parse out. I predict that Python will eventually get dedicated HTML syntax: perhaps something that uses indentation to indicate element nesting. Let's "vibe pseudocode" a sketch:
or whatever. | |||||||||||||||||
|