Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A clever comment style (akrzemi1.wordpress.com)
5 points by ingve on April 22, 2015 | hide | past | favorite | 3 comments


Something that always comes up in the discussion of structure editors is what to do about comments. Often a looser coupling of comments to the code is suggested. This article presents a good argument for a tighter linking of comments with code, which would be well-supported by a structure editor.

I think this would be cleaner than the proposed syntactic approach, which is clever but ugly (and so is likely to face resistance to adoption).

Another approach might be deeper editor integration of blame/annotation modes from version control, and versioned comments that were associated with specific lines in the file rather than being inline comments.


If you are going to do that, why not do this?

Example in C#

https://ideone.com/h0Kj80


I'm going to stick with this comment style:

    function initializeDevices(c) {
      // initialize the necessary devices:
      // listener, translator, etc
      c.go();
    }

    initializeDevices(c); // this call cannot be moved down

    bool ans = process_test_request();

    if (ans)
      report_success();




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: