Edward Elliott wrote: > 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.
Would you care to name a few languages which support nested block comments? There really aren't many: ML as you mentioned; Standard Pascal doesn't permit nesting of comments but *some* implementations do allow it. Want to comment out a block of code in C++? The only (nearly) reliable way is to insert single-line comments down the block. You can't use a block comment if there are any other block comments inside the code you want to block out. The danger of block comments is that if you forget to close the comment you can accidentally comment out a large part of your code. With support from the editor (coloured highlighting of comments) this isn't so bad, but then if you have a decent editor you don't need the block comments anyway as you will be able to comment/uncomment a block in your editor. Doc strings will usually work as an alternative, especially since you have a choice of two flavours of triple quoted strings, so if you use one for docstrings the other is always free for your temporary block comments. > Forcing programmers to write clean code with syntax is like teaching a > pig to sing: it wastes your time and annoys the pig. This pig gets much more annoyed having to maintain code which has large chunks of unneeded commented out code left over from some other programmer, or which has completely messed up indentation. -- http://mail.python.org/mailman/listinfo/python-list