Surely the solution is heredocs? You effectively define your own comment closing string at the comment opening point.
:
In some languages there is a very slight performance impact to doing this, however. Especially in the shell, because it actually has to juggle file descriptors whenever a heredoc or herestring is involved — even if you're directing it into a built-in like `:`. (It only costs a few-dozen microseconds though.)Also, heredocs are irritating because they usually can't deal with indentation properly. bash and zsh support the `Python's triple-quotes seem to solve all of these problems, and they're one of the best things about Python's grammar IMO. I wish every language had that, combined with the ability to treat expressions as statements. It'd be a little ugly in C-like languages, but certainly usable:
'''
my comment
''';