From: Sion Arrowsmith on 19 Apr 2006 10:52
Jorge Godoy <godoy(a)ieee.org> wrote:
>Is it harder to remove "n" lines of code commented out with "#" than "n"
>lines of multiline commented code? How?
I'd say it's harder to remove the latter, due to having to search for
the end of comment sequence, rather than simply looking for where the
block comment stops. And you've extra problems if you allow nested
comments, because then you'll have to count how deep you've gone. Of
course, if you can completely trust your editor's syntax highlighter
you might be OK, but wasn't part of the point of this argument about
not *requiring* smart editors to be productive?
\S -- siona(a)chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu become? se bera eadward ofdun hl?ddre heafdes b?ce bump bump bump
From: Jorge Godoy on 19 Apr 2006 11:14
Sion Arrowsmith wrote:
> I'd say it's harder to remove the latter, due to having to search for
> the end of comment sequence, rather than simply looking for where the
> block comment stops. And you've extra problems if you allow nested
> comments, because then you'll have to count how deep you've gone. Of
> course, if you can completely trust your editor's syntax highlighter
> you might be OK, but wasn't part of the point of this argument about
> not *requiring* smart editors to be productive?
Also, if you remove the start of the block first, then your editor might not
be highlighting anymore... With nested comments things get even worse
because you might miss the end of the outer block or something like that.
Jorge Godoy <godoy(a)ieee.org>
"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.
From: rx on 19 Apr 2006 13:41
"Edward Elliott" <nobody(a)127.0.0.1> wrote in message
> Ben Finney wrote:
>> Indeed. Using revision control means never needing to comment out
>> blocks of code.
> Typing (* and *) on a few line will always be quicker, easier, and less
> confusing than any rcs diffs/restores. Once you delete the code you can
> no longer see it or add pieces back in without retrieving it from an
> external store. I'm not saying nested comments solve every problem, just
> that there exists a certain (perhaps small) class of problems they solve
> particularly well.
> Personally, I rarely leave code commented out beyond a single coding
> session. But my particular coding habits aren't relevant here.
Well I perfectly agree, and why make a dependence on external tools
(IDE/CVS) if you can build it into the language with no conflicts by using
some strange ascii combinations. I'm sure something like:
would be fine.
From: Edward Elliott on 19 Apr 2006 13:51
Sion Arrowsmith wrote:
> Really? Under what circumstances is it easier to see what's going on
> with start/end comments than with comment-to-end-of-line?
Off the top of my head:
1. The code is usually easier to read as # can obscure the first token on
the line. This can be alleviated by leaving a space after the # or
coloring the # differently.
2. It's easier to see where a nested comment begins and ends. Instead of
counting #s at the beginning of lines, just find the matching closer. This
is fairly simple to automate in a good editor. Counting #s can be
automated as well, but fails if the programmer gets lazy and doesn't add
extra #s when nesting, i.e. turns this:
instead of this
3. Preserves history better. Say I have consecutive lines commented out.
With #s, all you see is this:
If they were commented out in two chunks at different times, multiline
comments can preserve that information:
This isn't meant to be an exhaustive list. There are ways to address all
these things with single-line comments, but it takes more work. Economy of
expression favors nested comments in my book.
Gregor has a good point about grep, but C-based languages with /**/ suffer
the same problem. I think the answer is smarter searches, not dumber comments.
From: rx on 19 Apr 2006 13:55
"Jorge Godoy" <godoy(a)ieee.org> wrote in message
> Edward Elliott wrote:
> You can use either """ or '''. I don't keep changing them in my code, so
> can always use the other type (usually I use " so for commenting things
> I'd use ') to do that.
Try that on this code:
b='''This is a
b='''This is a