February 08, 2018 proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
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"/ ``` |
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | On 02/08/2018 10:06 PM, Timothee Cour wrote: > > /"EOC > This is a multi-line > heredoc comment allowing > /+ documented unittests containing nesting comments +/ That shouldn't be an issue as long as you're using /++ doc comments and not /** ones. If it IS a problem, I'd regard it as a bug. (If I were in change of the world, /** and /* both would be compiler errors, banned from all commits, and non-nesting block comments of all types would be prohibited from all langauges upon pain of...well, pain. They are spawn of satan and should never exist.) > and weird urls like https://gcc.gnu.org/onlinedocs/libstdc++/faq.html *That* is a compelling point: Any embedded langauge (such as URL syntax) where +/ is valid. That, and maybe any code examples or discussions which, for any reason, intentially involve an unmatched end-of-comment. |
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | /** 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 */ |
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Friday, 9 February 2018 at 07:04:26 UTC, Nick Sabalausky (Abscissa) wrote:
> (If I were in change of the world, /** and /* both would be compiler errors, banned from all commits, and non-nesting block comments of all types would be prohibited from all langauges upon pain of...well, pain. They are spawn of satan and should never exist.)
Nested comments are superficial though, they were a mistake, really.
|
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 02/09/2018 03:42 AM, Kagamin wrote:
>
> Nested comments are superficial though,
Not if you've ever commented out a block of code.
|
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | 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 +/ Are you sure documented unittests work that way? https://run.dlang.io/is/grNpKK |
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 02/09/2018 03:37 AM, Kagamin wrote: > /** > 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 > */ /** This is a multi-line comment. Be sure to check the various files at extras/foo*/package.d And also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html */ Kaboom. Thank you, good night. |
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Friday, 9 February 2018 at 08:44:31 UTC, Nick Sabalausky (Abscissa) wrote:
> On 02/09/2018 03:42 AM, Kagamin wrote:
>>
>> Nested comments are superficial though,
>
> Not if you've ever commented out a block of code.
Comment this:
string sedArg="s/ +/ /";
Comments don't respect even lexical structure of commented code that you expect, version(none) does.
|
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | summary:
* `/* */` should never be used
* properly nested `/+ +/` indeed don't cause issues
* urls cause issues and I've ran into this issue multiple times
* unrestricted code (eg foreign code or unfinished D code commented
out) also cause issues
* hreredoc comments fixes these issues when neeeddd
On Fri, Feb 9, 2018 at 12:49 AM, Nick Sabalausky (Abscissa) via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On 02/09/2018 03:37 AM, Kagamin wrote:
>>
>> /**
>> 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
>> */
>
>
>
> /**
> This is a multi-line comment.
> Be sure to check the various files at extras/foo*/package.d
> And also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html
> */
>
>
> Kaboom. Thank you, good night.
|
February 09, 2018 Re: proposal: heredoc comments to allow `+/` in comments, eg from urls or documented unittests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | version(none) { FOO } doesn't work if FOO doesn't parse.
Again, what I proposed is the only 100% reliable way to comment out something
On Fri, Feb 9, 2018 at 12:52 AM, Kagamin via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Friday, 9 February 2018 at 08:44:31 UTC, Nick Sabalausky (Abscissa)
> wrote:
>>
>> On 02/09/2018 03:42 AM, Kagamin wrote:
>>>
>>>
>>> Nested comments are superficial though,
>>
>>
>> Not if you've ever commented out a block of code.
>
>
> Comment this:
> string sedArg="s/ +/ /";
>
> Comments don't respect even lexical structure of commented code that you
> expect, version(none) does.
|
Copyright © 1999-2021 by the D Language Foundation