proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests
Vladimir Panteleev
thecybershadow.lists at gmail.com
Sun Feb 11 08:32:34 UTC 2018
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?
}
More information about the Digitalmars-d
mailing list