Single Line Comments - Forum - OpenEdge Development - Progress Community
 Forum

Single Line Comments

  • Hello, I'm one of the devs working on ABL. Nothing is set in stone yet but we're looking into implementing single line comments. Anyway, here are some issues we'd like your feedback on.

    In an ideal world, we would use // as the starting delimiter for line comments. However, this clashes with statements like:

    OS-DELETE C://tmp/tmp.txt.
    RUN //rdlserv/cdimage/foo.p. /* This is a UNC path */ 

    A few other statements that possibly use // as valid syntax are most of the OS-* statements, INPUT, OUTPUT, RUN, SYSTEM-DIALOG GET-DIR/FILE, and COMPILE.

    How would you guys feel if single line syntax was //<whitespace>? This would allow it to be differentiated from paths and wouldn't be too different from industry standard. On the other hand, it's a bit more tedious and it's pretty easy to forget that a space is required, especially if you have a background in languages like Java, PHP, or C++.

    Another solution is to use different characters for single line comments. One of our most favorable alternative syntax is two semi-colons (;;). # is unfortunately out of the question since we allow that character in variable names. Using different characters removes the whitespace requirement but will vary differently from what's typical in other languages. 

    The last solution is to implement // without whitespace. This will cause behaviour changes that might break statements where a path is hardcoded with double slashes and without quoting the path. However, it'll be the simplest and most expected form of single line comments. Discussion here in HQ asserts that the number of people whose code will be broken with this change is very, very small since you guys should be relying on PROPATH instead of hardcoding absolute paths anyway.

    So in short, here's what I'd like to hear back from you guys:

    a. Which  syntax would you prefer most: //, //<whitespace>, or some other syntax?

    b. How many of you have code that would be broken if we implemented // as single line comments? If you do, would the benefit of having single line comments outweigh the detriment of potential code failure?  

    c. If you prefer alternative syntax, do you have any other character combinations in mind?

    Thanks!

  • I believe // followed by a white space would be acceptable.
    Assuming that the editors (32bit Procedure Editor and PDSOE) do display this properly as a green comment.
    Von: aestrada [mailto:bounce-aestrada@community.progress.com]
    Gesendet: Donnerstag, 21. Mai 2015 18:18
    An: TU.OE.Development@community.progress.com
    Betreff: [Technical Users - OE Development] Single Line Comments
     
    Thread created by aestrada

    Hello, I'm one of the devs working on ABL. Nothing is set in stone yet but we're looking into implementing single line comments. Anyway, here are some issues we'd like your feedback on.

    In an ideal world, we would use // as the starting delimiter for line comments. However, this clashes with statements like:

    OS-DELETE C://tmp/tmp.txt.

    A few other statements that possibly use // as valid syntax are most of the OS-* statements, INPUT, OUTPUT, RUN, SYSTEM-DIALOG GET-DIR/FILE, and COMPILE.

    How would you guys feel if single line syntax was //<whitespace>? This would allow it to be differentiated from paths and wouldn't be too different from industry standard. On the other hand, it's a bit more tedious and it's pretty easy to forget that a space is required, especially if you have a background in languages like Java, PHP, or C++.

    Another solution is to use different characters for single line comments. One of our most favorable alternative syntax is two semi-colons (;;). # is unfortunately out of the question since we allow that character in variable names. Using different characters removes the whitespace requirement but will vary differently from what's typical in other languages. 

    The last solution is to implement // without whitespace. This will cause behaviour changes that might break statements where a path is hardcoded with double slashes and without quoting the path. However, it'll be the simplest and most expected form of single line comments. Discussion here in HQ asserts that the number of people whose code will be broken with this change is very, very small since you guys should be relying on PROPATH instead of hardcoding absolute paths anyway.

    So in short, here's what I'd like to hear back from you guys:

    a. Which  syntax would you prefer most: //, //<whitespace>, or some other syntax?

    b. How many of you have code that would be broken if we implemented // as single line comments? If you do, would the benefit of having single line comments outweigh the detriment of potential code failure?  

    c. If you prefer alternative syntax, do you have any other character combinations in mind?

    Thanks!

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Shelley will be happy!

    I wonder how common // is in path names.  I think I would be inclined to include whitespace anyway, just for readability, but I would also think most path names were single slash and in quotes.

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • that will be cool, for me '//' should work just fine if you think that can be an issue with it appearing in valid statement enforce it so it's only considered if first (not empty) sequence  on the line... I know Java lets you do it later on the same line where there is code already but I don't like it much so would vote for '//' at start of the line :)

  • Can live with that as well.

    Von meinem Windows Phone gesendet

    Von: Marian Edu
    Gesendet: ‎21.‎05.‎2015 18:30
    An: TU.OE.Development@community.progress.com
    Betreff: RE: [Technical Users - OE Development] Single Line Comments

    Reply by Marian Edu

    that will be cool, for me '//' should work just fine if you think that can be an issue with it appearing in valid statement enforce it so it's only considered if first (not empty) sequence  on the line... I know Java lets you do it later on the same line where there is code already but I don't like it much so would vote for '//' at start of the line :)

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Unfortunately, since ABL is whitespace agnostic, there isn't really a way to implement // at the start of a line.

    OS-DELETE

    //dir/file.txt.

    will be treated as:

    OS-DELETE  //dir/file.txt.

  • Besides, I would think one of the prime uses would be adding a short comment on the end of a line.

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • //<whitespace>  seems like a good rule.
    //This is not a comment
    But // this is
  • If // is problematic, would /// be any better?  Like XML comments?

  • It definitely will be rarer but /// is still valid syntax in some statements. For example:

    OS-DELETE ////path///to///file. /* this works because Unix eats up slashes */
  • My question is, are there actually people who want to use this who would not put a space in anyway, just for readability?

    It certainly wouldn't take long to reinforce!

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • I agree that //<whitespace> is the best.  And it would make adding a quick comment much easier.

  • "'// " is a non-starter for me as any syntax token that requires
    whitespace as part of the token a no-go.

    I'd prefer

    //*

    This makes it similar to the current /* */, and enables constructs like:

    //*

    FOR EACH customer NO-LOCK:
    /* stuff */
    END.

    //* */

    Get rid of the leading "/" on the first in-line comment, and the
    entire section's commented out.

    Tim

    On Thu, May 21, 2015 at 12:17 PM, aestrada
    wrote:
    > Single Line Comments
    > Thread created by aestrada
    >
    > Hello, I'm one of the devs working on ABL. Nothing is set in stone yet but
    > we're looking into implementing single line comments. Anyway, here are some
    > issues we'd like your feedback on.
    >
    > In an ideal world, we would use // as the starting delimiter for line
    > comments. However, this clashes with statements like:
    >
    > OS-DELETE C://tmp/tmp.txt.
    >
    > A few other statements that possibly use // as valid syntax are most of the
    > OS-* statements, INPUT, OUTPUT, RUN, SYSTEM-DIALOG GET-DIR/FILE, and
    > COMPILE.
    >
    > How would you guys feel if single line syntax was //? This would
    > allow it to be differentiated from paths and wouldn't be too different from
    > industry standard. On the other hand, it's a bit more tedious and it's
    > pretty easy to forget that a space is required, especially if you have a
    > background in languages like Java, PHP, or C++.
    >
    > Another solution is to use different characters for single line comments.
    > One of our most favorable alternative syntax is two semi-colons (;;). # is
    > unfortunately out of the question since we allow that character in variable
    > names. Using different characters removes the whitespace requirement but
    > will vary differently from what's typical in other languages.
    >
    > The last solution is to implement // without whitespace. This will cause
    > behaviour changes that might break statements where a path is hardcoded with
    > double slashes and without quoting the path. However, it'll be the simplest
    > and most expected form of single line comments. Discussion here in HQ
    > asserts that the number of people whose code will be broken with this change
    > is very, very small since you guys should be relying on PROPATH instead of
    > hardcoding absolute paths anyway.
    >
    > So in short, here's what I'd like to hear back from you guys:
    >
    > a. Which syntax would you prefer most: //, //, or some other
    > syntax?
    >
    > b. How many of you have code that would be broken if we implemented // as
    > single line comments? If you do, would the benefit of having single line
    > comments outweigh the detriment of potential code failure?
    >
    > c. If you prefer alternative syntax, do you have any other character
    > combinations in mind?
    >
    > Thanks!
    >
    > Stop receiving emails on this subject.
    >
    > Flag this post as spam/abuse.



    --
    Tim Kuehn: Senior Consultant - TDK Consulting Services
    President - Ontario PUG
    Program Committee Chair - PUG Challenge Americas,
    Course Instructor: Intro to OO Concepts for Procedural Programmers

    Skype: timothy.kuehn
    Ph: 519-576-8100
    Cell: 519-781-0081
  • Don't really like //*

    And I don't get your argument about the white space. Many ABL tokens must be followed by a white space.

    Part of this enhancement is to make the ABL easier for non ABL developers. And // is the norm. And an additional white space will make it easier to read anyway

    Von meinem Windows Phone gesendet

    Von: Tim Kuehn
    Gesendet: ‎21.‎05.‎2015 19:15
    An: TU.OE.Development@community.progress.com
    Betreff: Re: [Technical Users - OE Development] Single Line Comments

    Reply by Tim Kuehn
    "'// " is a non-starter for me as any syntax token that requires
    whitespace as part of the token a no-go.

    I'd prefer

    //*

    This makes it similar to the current /* */, and enables constructs like:

    //*

    FOR EACH customer NO-LOCK:
    /* stuff */
    END.

    //* */

    Get rid of the leading "/" on the first in-line comment, and the
    entire section's commented out.

    Tim

    On Thu, May 21, 2015 at 12:17 PM, aestrada
    wrote:
    > Single Line Comments
    > Thread created by aestrada
    >
    > Hello, I'm one of the devs working on ABL. Nothing is set in stone yet but
    > we're looking into implementing single line comments. Anyway, here are some
    > issues we'd like your feedback on.
    >
    > In an ideal world, we would use // as the starting delimiter for line
    > comments. However, this clashes with statements like:
    >
    > OS-DELETE C://tmp/tmp.txt.
    >
    > A few other statements that possibly use // as valid syntax are most of the
    > OS-* statements, INPUT, OUTPUT, RUN, SYSTEM-DIALOG GET-DIR/FILE, and
    > COMPILE.
    >
    > How would you guys feel if single line syntax was //? This would
    > allow it to be differentiated from paths and wouldn't be too different from
    > industry standard. On the other hand, it's a bit more tedious and it's
    > pretty easy to forget that a space is required, especially if you have a
    > background in languages like Java, PHP, or C++.
    >
    > Another solution is to use different characters for single line comments.
    > One of our most favorable alternative syntax is two semi-colons (;;). # is
    > unfortunately out of the question since we allow that character in variable
    > names. Using different characters removes the whitespace requirement but
    > will vary differently from what's typical in other languages.
    >
    > The last solution is to implement // without whitespace. This will cause
    > behaviour changes that might break statements where a path is hardcoded with
    > double slashes and without quoting the path. However, it'll be the simplest
    > and most expected form of single line comments. Discussion here in HQ
    > asserts that the number of people whose code will be broken with this change
    > is very, very small since you guys should be relying on PROPATH instead of
    > hardcoding absolute paths anyway.
    >
    > So in short, here's what I'd like to hear back from you guys:
    >
    > a. Which syntax would you prefer most: //, //, or some other
    > syntax?
    >
    > b. How many of you have code that would be broken if we implemented // as
    > single line comments? If you do, would the benefit of having single line
    > comments outweigh the detriment of potential code failure?
    >
    > c. If you prefer alternative syntax, do you have any other character
    > combinations in mind?
    >
    > Thanks!
    >
    > Stop receiving emails on this subject.
    >
    > Flag this post as spam/abuse.



    --
    Tim Kuehn: Senior Consultant - TDK Consulting Services
    President - Ontario PUG
    Program Committee Chair - PUG Challenge Americas,
    Course Instructor: Intro to OO Concepts for Procedural Programmers

    Skype: timothy.kuehn
    Ph: 519-576-8100
    Cell: 519-781-0081
    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • > I believe // followed by a white space would be acceptable.

    > Assuming that the editors (32bit Procedure Editor and PDSOE) do display this properly as a green comment.

    That's a good point. SlickEdit doesn't allow us to define a comment sequence that includes a whitespace token. It will color both "//comment" and "// comment" green. I don't know how PDSOE will handle it.

    I'm in the "//" camp (no whitespace). I doubt that there are more than a few instances of "RUN //hard/coded/path.p" and the like out there.