proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sun Feb 11 01:01:21 UTC 2018


On Saturday, February 10, 2018 15:03:08 Walter Bright via Digitalmars-d 
wrote:
> On 2/8/2018 7:06 PM, 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"/
>
> There isn't any commenting scheme that won't trip you up with certain
> characters in the comments. I don't see a compelling case for adding
> another kind of comment.
>
> Vladimir's suggestion to use %2B instead of + seems to resolve this
> adequately.

You could also always just declare a DDOC macro.

Just put

Macros:
    PLUS=+

in the ddoc comment and then use $(PLUS) instead of +. It's more verbose
that way given that PLUS isn't one of the standard ddoc macros, but it's
more idiomatic to look at.

- Jonathan M Davis



More information about the Digitalmars-d mailing list