Menu

#34 Comment at same line as identifier

open
nobody
None
5
2012-11-05
2006-09-08
kogerbnz
No

Hi

var
MyVar: Integer; //This is my var
AnotherVar: Integer;

As you might have guessed from this example, the
comment for MyVar is associated with AnotherVar.

Can you not associate it with the same identifier as
one the same line where the comment it written.
I known about the //< workaround, but it's a bit
troublesome to update my project and I think it would
be more intuitive if the comment was default to the
identifier at the same line. Perhaps you could add the
feature as a switch, so people could turn it on or off
as they pleased.

Thank you.

Discussion

  • Michalis Kamburelis

    Logged In: YES
    user_id=987895

    I don't think that this is a good idea. Writing additional
    "<" character at the beginning of your comments is not that
    much trouble, and the advantages are that

    1. You don't have to activate any pasdoc option to make this
      work.

    2. It follows the general Pascal syntax rule that "amount of
      whitespace doesn't matter".

    The same approach was taken by doxygen, so pasdoc is not
    alone in this decision.

    If you have a large amount of code that was commented
    without keeping some pasdoc rules, and then you decide to
    make the comments "pasdoc-compatible", you will always have
    to do some work. In many cases pasdoc will "just work" and
    produce sensible documentation, but for a really
    good-looking documentation some adjustments will be always
    needed (and you will probably want to add some @-tags here
    and there anyway).

    In other words, I think that if we will try to make new
    pasdoc command-line (or pasdoc_gui option) to embrace the
    preferred syntax of every possible programmer, it will be
    never-ending work. At some point, a programmer must adjust
    his comments to the way pasdoc expects them.

    So in this particular case, I'm tempted to reject this
    request. You may be able to quickly update your code by a
    series of regular expression replacements like
    ,( *)//([^<])
    to
    ,\1//<\2
    (this will add "<" in all lines that have ",", then some
    whitespace, then "//" but not "//<" yet). This can be
    automated by e.g. sed.

    Any comments anyone ?

     
  • kogerbnz

    kogerbnz - 2006-09-11

    Logged In: YES
    user_id=1420753

    Hi

    Thanks for your reply.
    I agree with you that at some point it should be the
    programmer who structured the code to fit Pasdoc and not the
    other way around.

    But I must say that I like to sometimes comment a variable,
    property or function especially in classes at the same line
    and not before. You are probably the one who knows best how
    programmeres comment their code, so if you think I'm the
    only (or we are small bunch) then I guess it makes sense not
    to add this support, even though I would have liked it very
    much ;-)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.