proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests
Martin Tschierschke
mt at smartdolphin.de
Sun Feb 11 12:54:39 UTC 2018
On Friday, 9 February 2018 at 03:06:56 UTC, Timothee Cour wrote:
> same exact idea as motivation for delimited strings
> (https://dlang.org/spec/lex.html#delimited_strings)
>
> ```
>
> auto heredoc = q"EOS
> This is a multi-line
> heredoc string
> EOS"
> ;
>
> /"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"/
>
> ```
I thought about it, what if you define, that the /+ +/ comment,
is not started by
'/+' alone but by '/+ ' that means that the char behind the plus
defines the ending of the comment.
So that /+my_special_block has to end with my_special_block+/
And '/+ ' with ' +/' where all whitespace characters should be
allowed (\newline \tab \space).
I know that this might be a somehow breaking change, but it would
not require a totally different kind of syntax.
And the mentioned URL-Strings lib++/ will not match for '/+ ' .
Would be interesting how often people write /+directly followed
by the comment, without a space or the same at the end+/
More information about the Digitalmars-d
mailing list