Skip to content

Instantly share code, notes, and snippets.

@olov
Created November 13, 2014 07:33
Show Gist options
  • Select an option

  • Save olov/3d62764849a604caeb01 to your computer and use it in GitHub Desktop.

Select an option

Save olov/3d62764849a604caeb01 to your computer and use it in GitHub Desktop.

Revisions

  1. olov created this gist Nov 13, 2014.
    21 changes: 21 additions & 0 deletions whatever.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    // yoyoyomamama comment on the file (note blank line after it)

    // comment bound to function
    function foo() {

    // comment bound to if-statement
    if (a) {
    // comment bound to first block

    b(); // comment bound to statement
    } else if (b) {
    // comment bound to second block

    b(/* comment bound to expr */ 1);
    }
    }

    // and so one. yah the devil is in the details but this is what we end up figuring out in tooling anyways
    // so why not make it explicit with a few rules in the spec. the spec can also allow "free" comments i.e.
    // all those that are not covered by any binding rules. Tooling keeps them with best-effort and linters
    // can detect the presense of those.