On Friday, 9 February 2018 at 03:06:56 UTC, Timothee Cour wrote:
/"EOC
This is a multi-line
heredoc comment allowing
/+ documented unittests containing nesting comments +/
and weird urls like https://gcc.gnu.org/onlinedocs/libstdc++/faq.html
EOS"/

This syntax is syntactically ambiguous.

struct StringNumber
{
    string s;
    string opBinary(string op)(string b)
    {
        import std.conv;
        return mixin(`(this.s.to!long ` ~
            op ~ ` b.to!long).to!string`);
    }
}

unittest
{
    assert(StringNumber("4")+"2" == "6");
    assert(StringNumber("4")-"2" == "2");
    assert(StringNumber("4")*"2" == "8");
    assert(StringNumber("4")/"2" == "2"); // Conflict!
            // Division by string, or nested comment?
}

Reply via email to