News for hackers. Stuff that matters.
Re:The hardest program I've ever written (2015) by javbit on Saturday March 05, 2022 @10:09AM (#30568188)
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.

There are no comments on this comment yet.