From: Sion Arrowsmith on
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
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

"Edward Elliott" <nobody(a)127.0.0.1> wrote in message
news:URk1g.72511$dW3.48789(a)newssvr21.news.prodigy.com...
> 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:

a()
(#
b()
c()
#)
d()

would be fine.


From: Edward Elliott on
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:

line 1
#line 2
line 3

into this

#line 1
#line 2
#line 3

instead of this

#line 1
##line 2
#line 3

3. Preserves history better. Say I have consecutive lines commented out.
With #s, all you see is this:

#line 1
#line 2
#line 3
#line 4

If they were commented out in two chunks at different times, multiline
comments can preserve that information:

(*
line 1
line 2
*)
(*
line 3
line 4
*)

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

"Jorge Godoy" <godoy(a)ieee.org> wrote in message
news:2145108.A1WUCsNlIN(a)jupiter.g2ctech...
> Edward Elliott wrote:
>

>
> You can use either """ or '''. I don't keep changing them in my code, so
> I
> can always use the other type (usually I use " so for commenting things
> out
> I'd use ') to do that.
>

Try that on this code:

a=3
a=a*a
b='''This is a
very long
long
text'''
print a


like:

a=3
'''
a=a*a
b='''This is a
very long
long
text'''
'''
print a



raises SyntaxError


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: how do you pronounce 'tuple'?
Next: A Unicode problem -HELP