I’d like to add another use-case for this.
I’m the maintainer of a small django library called django-components. I’ve run into a problem that I have a language-level solution (tagged strings) to, that I think would benefit the wider python community.
Problem
A component in my library is a combination of python code, html, css and javascript. Currently I glue things together with a python file, where you put the paths to the html, css and javascript. When run, it brings all of the files together into a component. But for small components, having to juggle four different files around is cumbersome, so I’ve started to look for a way to put everything related to the component in the same file. This makes it much easier to work on, understand, and with fewer places to make path errors.
Example:
class Calendar(component.Component):
template_string = '<span class="calendar"></span>'
css_string = '.calendar { background: pink }'
js_string = 'document.getElementsByClassName("calendar)[0].onclick = function() { alert("click!") }'
Seems simple enough, right? The problem is: There’s no syntax highlighting in my code editor for the three other languages. This makes for a horrible developer experience, where you constantly have to hunt for characters inside of strings. You saw the missing quote in js_string right?
If I instead use separate files, I get syntax highlighting and auto-completion for each file, because editors set language based on file type. But should I really have to choose?
First steps
I think a great first step would be to allow these kind of tags in the language, but don’t yet do anything with them. Then editors could implement highlighting and a lot of the wins could be realized quickly (?).