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

Kagamin spam at here.lot
Fri Feb 9 12:11:46 UTC 2018


On Friday, 9 February 2018 at 11:16:01 UTC, Nick Sabalausky 
(Abscissa) wrote:
> On 02/09/2018 05:31 AM, Kagamin wrote:
>> On Friday, 9 February 2018 at 09:42:46 UTC, Nick Sabalausky 
>> (Abscissa) wrote:
>>> Huh? So are you *pro-* or *anti-* heredoc?
>> I personally prefer python's triple quoted strings. Elegant, 
>> simple and enough for most stuff. That example only shows what 
>> D has.
>> version(none)q{ FOO }; is likely to work for most stuff too.
>
> /+ +/ is likely to work for most stuff, too.

So do /* */
It was only a minor problem for C89, because it had no line 
comments and people didn't know about #if 0

> I think version(none) has solidly proven that higher-level 
> semantic code-disabling, while sounds like a great idea on 
> paper, actually provides no practical, non-theoretical gains 
> other than the ability to nest, which /+ +/ shares (along with 
> the ability to be used in more scenarios and be less verbose).

I insert version(none) with just Ctrl+V which is faster and 
easier than any stream comment that requires you to jump back and 
forth to properly catch a bunch of raw characters. Also with it 
you can switch alternative implementations like
version(all)
   ...
else
   ...
If the code is not deleted, it's useful; if it's useful, it will 
be used; to be used it must be readable; to be readable it should 
be highlighted; to highlighted it shouldn't be a comment.

> /**
> Be sure to check the various files at extras/foo*/package.d
> and also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html
> */
>
> Unlike the "disabling code that contains the 
> end-of-disabled-code token" stuff, THIS example isn't quite so 
> trivial to deal with in a way that's reasonably readable from 
> both the generated docs and from within the code itself.

/**
Be sure to check the various files at extras/foo.../package.d
and also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html
*/

Ok, somebody might be unable to come up with this, but people 
didn't know about #if 0 until told.


More information about the Digitalmars-d mailing list