Hacker News new | ask | show | jobs
by javbit 1569 days ago
If the display of the code is removed from its representation, I think the same could be done for comments. Comments could be kept as part of the AST and rendered how you like.

E.g.

    (+ 1 2)  ; Add two numbers.
Would become

    (comment (+ 1 2) "Add two numbers")
With semantics like const.

Another would be

    (+  ; Adding
     1  ; one
     2  ; and two.
     )
To

    ((comment + "add")
     (comment 1 "one")
     (comment 2 "two"))
You could display comments as popups, marginalia, or even in a traditional fashion (since some intent is captured by the comment scoping. You could also have different types of comments like annotation to have different kinds of display types.