January 07, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini | "Roberto Mariottini" <rmariottini@lycosmail.com> wrote in message news:a1ck0f$1alu$1@digitaldaemon.com... > >@@ > .. big block of text, with nested >@@ and <@@ ... > <@@ Maybe then <@ @> ? |
January 08, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini | Roberto Mariottini wrote:
> "Pavel Minayev" <evilone@omen.ru> ha scritto nel messaggio
> news:a0th24$svc$1@digitaldaemon.com...
>
>>"Walter" <walter@digitalmars.com> wrote in message
>>news:a0tbj5$ptm$1@digitaldaemon.com...
>>
>>
>>>no. Use the version statement to block out sections.
>>>
>>Unfortunately, version cannot comment out blocks with bad syntax -
>>which is needed sometimes. For example, I occasionally start
>>writing something, then decide to try another idea, but comment
>>the unfinished block out rather than deleting it in case I'll
>>revert back to it later... and such a block may have improper
>>syntax (like "if(a == ").
>>
>
> I also often need nested comments as a fast way to comment-out weird code.
> To me seems better to define a new style of comment to comment out big
> blocks of code
> (or a block of natural language description)....
>
>
>>@@
>>
> .. big block of text, with nested >@@ and <@@ ...
> <@@
>
> I like to think this comment must be at column 0, so it's easy to
> distinguish from normal code
Insert the text:
//weirdcode//
at the beginning of each line.
Or, use the D-in-HTML feature and comment out large chunks with
<!-- ... -->
-RB
|
January 08, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Borogove | "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C3A713E.4050605@estarcion.com... > Insert the text: > > //weirdcode// > > at the beginning of each line. Suppose you have 100 lines... > Or, use the D-in-HTML feature and comment out large chunks with <!-- ... --> For this to work, file must have .html extension. I personally prefer .d =) |
January 08, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | So name them foo.d.html ;) Might be nice for D compiler to automatically detect a <html> tag and assume it should start parsing HTML automagically until it finds a </html>. So long as Walter never wants to use C++ template syntax this shouldn't be a problem. Then you can just use foo.d as your file name. Sean "Pavel Minayev" <evilone@omen.ru> wrote in message news:a1egsp$2g3g$1@digitaldaemon.com... > "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C3A713E.4050605@estarcion.com... > > > Insert the text: > > > > //weirdcode// > > > > at the beginning of each line. > > Suppose you have 100 lines... > > > Or, use the D-in-HTML feature and comment out large chunks with <!-- ... --> > > For this to work, file must have .html extension. I personally prefer .d =) |
January 08, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev wrote:
> "Russell Borogove" <kaleja@estarcion.com> wrote in message
> news:3C3A713E.4050605@estarcion.com...
>
>
>>Insert the text:
>>
>>//weirdcode//
>>
>>at the beginning of each line.
>>
>
> Suppose you have 100 lines...
Suppose you have an editor that can paste a rectangular
selection and drop down to the same column on the next
line in a single keystroke. (Dev Studio, for example)
Anyway, that's what works for me, and I understand it
doesn't work for everybody.
-RB
|
January 08, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Borogove | "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3C3B64F8.4070003@estarcion.com... > Suppose you have an editor that can paste a rectangular > selection and drop down to the same column on the next > line in a single keystroke. (Dev Studio, for example) Well I do hav DevIde. But since it doesn't support D (yet?), I have to use the FAR built-in editor + Colorer plug-in, after writing a highlighting scheme for D. Unfortunately, this editor doesn't support tricks like the one you mentioned... |
January 17, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a0ujps$1iqj$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a0tv8q$15rd$1@digitaldaemon.com... > > > I've been considering making version more tolerant of bad syntax, but it > is > > going to have to count { and } ! > > Still... what's wrong with nested comments? It's really funny to see that, even though ANSI commitee didn't make them standart, most C++ compilers around have a switch which enables them. It's not so hard to implement, but could be a useful thing! > Yes indeed, what *is* wrong with nested comments? It seems almost no language supports it (C/C++, Java, Pascal, HTML, D?) but why? Is it that difficult to implement? Is it a feature that would easily be misused? Is there something I am totally missing? Personally I think one of the very big disadvantages of all the languages mentioned above is their lack of nested comments. It is just so easy to comment out a block of code for debugging purposes with the /* and */ comments...I never ever use /* and */ for normal comments, because then I 'lose' the option to comment out blocks of code. So when I write a function header comment, it looks like this: // =================================== // Print ([in] char[] string) // // DESCRIPTION: Prints out the string argument to stdout // ARGUMENT: string: The string to print // RETURNS: - // EXCEPTIONS: - // ---------------------------------------------------- Something like that... I would rather want to use /* */ but because they can't be nested it causes all kinds of problems, so I avoid using them for normal comments at all. Worse still, when I get someone elses code, who does use /* and */ I am in trouble... So I beg you, please make the comments nest...It would solve a lot of problems (for me). -- Stijn OddesE_XYZ@hotmail.com http://www.OddesE.f2s.com __________________________________________ Remove _XYZ from my address when replying by mail |
January 17, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to OddesE | > Worse still, when I get someone elses code, who does > use /* and */ I am in trouble... Just use #if 0 /* Commented out code */ #endif |
January 17, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin York | "Martin York" <Martin.York@veritas.com> wrote in message news:a27ara$nbl$1@digitaldaemon.com... > Just use > > #if 0 > > /* Commented out code > > */ > > #endif D doesn't have preprocessor! One could use the version() blocks but they require correct code syntax inside themselves, so it's just a partial solution. |
January 17, 2002 Re: nested comments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a27b0o$nl7$1@digitaldaemon.com... > "Martin York" <Martin.York@veritas.com> wrote in message news:a27ara$nbl$1@digitaldaemon.com... > > > Just use > > > > #if 0 > > > > /* Commented out code > > > > */ > > > > #endif > > D doesn't have preprocessor! > > One could use the version() blocks but they require correct code syntax inside themselves, so it's just a partial solution. > > Maybe this is a feature that needs to be added to languages (in general) The ability to "comment" out sections of code for debugging purposes, but that refuses to compile in release mode. Just a thought. Martin |
Copyright © 1999-2021 by the D Language Foundation