Closed rjbs closed 2 years ago
Overall, LGTM give or take a couple of small comments.
One thing left unsaid is how to write a literal open-brace
{
character inside one of these quoted template strings. I suspect the answer would beqt{This is in \{literal braces\}}
as per usual, but it would be good to spell that out in an example.
Or as qt({...})
, no?
About heredocs. Maybe qt infront of curly braces should be dropped (<<{END}
instead of <<qt{END}
). Curly braces are kind of a distinctive feature of template strings and Perl doesn't allow other general quote constructs like q, qq and qx as a heredoc modifier. Or maybe instead Perl should support all of them to make the thing more complete and explicit. But a bareword can serve as a heredoc delimiter so q, qq, qx and qt would be parsed as barewords. Parsing general quote constructs could be difficult. I prefer curly braces without prefix.
Or as
qt({...})
, no?
No. The delimiters for template sections are always { }
, no matter what the outer delimiters are. So qt(a b {1 + 2} c)
and qt{a b {1 + 2} c}
would act the same.
It's implied that
$scalar
and@array
interpolations would not happen in theqt
string, but probably should be stated explicitly.Also probably worth being explicit about how escape sequences work. Do all the normal backslash escapes work? And can the
{
be escaped to prevent it from being a template section?