Skip to Content.
Sympa Menu

devel - [sympa-developpers] Code in paragraphs

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: [sympa-developpers] Code in paragraphs
  • Date: Tue, 18 Feb 2014 19:16:28 +0900

Hi,

I feel it is a good practice to chunk sequence of statement to
several paragraohs and to place one line comment at each of them:

if (....) {
# Comment describing paragraph 1.
...
...
<== Empty line
# Comment describing paragraph 2.
...
...
# ... code commented-out
...
...
}

Perltidy helps formatting such paragraphs: It inserts one empty line
before each one-line comment with single hash (#) (Perltidy manpage
calls such comment "block comment").

However, sometimes such reformatting seems inconvenient: The example
above will be reformatted as:

if (....) {
<== Empty line, unexpected.
# Comment describing paragraph 1.
...
...
<== Empty line
# Comment describing paragraph 2.
...
...
<== Empty line, unexpected.
# ... code commented-out
...
...
}

So perltidy also provides "static block comment" feature: By default,
one-line comment with double hash (##) will cancel reformatting.

if (....) { <== Won't insert empty line
## Comment describing paragraph 1.
...
...
<== Will insert empty line
# Comment describing paragraph 2.
...
...
## ... code commented-out <== Won't insert empty line
...
...
}

However, someones may feel inconvenient on this feature. In the
example above, double hash should be used for the first paragraph
then single hash should be used for the second.


After all, I have an idea that "block comment" feature of perltidy
would be disabled (adding "sbcp=#" line to .perltidyrc) and that
programmers would insert empty line manually if neccessary.

Any comments?


Regards,

--- Soji

--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/


  • [sympa-developpers] Code in paragraphs, IKEDA Soji, 02/18/2014

Archive powered by MHonArc 2.6.19+.

Top of Page