Re: String Literals, take 3

[email protected] ("Joseph F. Ryan") Thu, 05 Dec 2002 15:23:48 -0500
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
Peter Haworth wrote:

>On Thu, 5 Dec 2002 04:05:05 -0500, Tanton Gibbs wrote:
>  
>
>>>A string inside a \qq[] construct acts exactly as if it were an
>>>interpolated string. Note that any end-brackets, "]", must be escaped
>>>within the the \qq[] construct so that the parser can read it correctly.
>>>      
>>>
>>Note that an end-bracket, ], must be escaped within the \qq[] construct.
>>This allows the parser to correctly parse the construct.
>>    
>>
>
>Don't embedded qq[] strings obey the normal qq[] rules? That is, will
>all brackets need escaping, or just unbalanced brackets? I'd hope for
>the latter.
>

With all of the new crazy quoting shenanagains, I'm not sure that the
"balenced brackets are fine" rule will still be possible; and thus end
delimeters will always need to be escaped.  For instance, imagine
what a nightmare this would be to parse:

$var = qq[blah [\q[blah [\qq[%hash{qq[[hi]]}]]]] blah];

Sure, anyone who writes something like this deserves to be shot;
however, if the "balanced brackets are ok" rule still stands, the
above code would be legal.  (And I really, really, really don't
want the above code to be legal ;)