Delimited strings

Timon Gehr timon.gehr at gmx.ch
Tue Feb 14 17:09:58 PST 2012


On 02/15/2012 02:03 AM, H. S. Teoh wrote:
> On Wed, Feb 15, 2012 at 01:46:51AM +0100, Timon Gehr wrote:
> [...]
>> No, q"abca" is illegal. The pattern is
>>
>> q"identifier
>> string
>> identifier"
>>
>> (The terminating new line is kept, so the string in this case is
>> "string\n")
>
> I see. The online specs need to be clarified, then.
>
>
> [...]
>>> So does this mean that you can write:
>>>
>>> 	q"(foo(q"(xxx)"))"
>>>
>>> and have it represent the string
>>>
>>> 	foo(q"(xxx)")
>>>
>>> ?
>>
>> Yes.
>
> I see.
>
>
> [...]
>>> 	q"(a)b)"
> [...]
>> It is illegal because the parens do not match.
>
> OK, I see. Thanks for the clarification.
>
> Makes me wonder, though: what's the purpose of this convoluted
> construction? I mean, I can understand why being able to write
> q"(z=q"(y)";)" would be useful, but why should it matter that the
> parentheses in q"(a(b))" match? What's the purpose of this restriction?
>
>
> T
>

q"(()")"









More information about the Digitalmars-d-learn mailing list