On 2017-10-11 10:35, Walter Bright wrote:
On 10/10/2017 3:16 PM, sarn wrote:
Works even better in D because it can run at compile time.

Yes, I see no need for a language feature what can be easily and far more flexibly done with a regular function - especially since what |q{ and -q{ do gives no clue from the syntax.

Unfortunately it doesn't work for the other multiline syntax:

void main()
{
    auto a = q"FOO
        int b = 3;
    FOO";
}

The above fails to compile [1]. The trailing FOO cannot be indented. This works:

void main()
{
    auto a = q"FOO
        int b = 3;
FOO";
}

Which in my opinion doesn't look as good as the first example. It gets worse if "a" is indented even more, because it's nested in a class, in a method, in an if statement and so on.

[1] main.d(3,14): Error: unterminated delimited string constant starting at main.d(3,15)

--
/Jacob Carlborg

Reply via email to