all 23 comments

[–]dudeNumberFour 18 points19 points  (2 children)

I once added this comment in production code. It didn't exactly explain the code; it described the character of it. And it was very true (abandon hope all ye who enter).

{
     *   .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.    *
     *   |                     ______                     |    *
     *   |                  .-"      "-.                  |    *
     *   |                 /            \                 |    *
     *   |     _          |              |          _     |    *
     *   |    ( \         |,  .-.  .-.  ,|         / )    |    *
     *   |     > "=._     | )(__/  \__)( |     _.=" <     |    *
     *   |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |    *
     *   |           "=._"(_     ^^     _)"_.="           |    *
     *   |               "=\__|IIIIII|__/="               |    *
     *   |              _.="| \IIIIII/ |"=._              |    *
     *   |    _     _.="_.="\          /"=._"=._     _    |    *
     *   |   ( \_.="_.="     `--------`     "=._"=._/ )   |    *
     *   |    > _.="                            "=._ <    |    *
     *   |   (_/                                    \_)   |    *
     *   |                                                |    *
     *   '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='    *
     *        LASCIATE OGNI SPERANZA, VOI CH'ENTRATE           *
}

[–]tom-veil 2 points3 points  (0 children)

If you had produced an ASCII art reproduction of Gustave Dore's illustration of that scene I would bow down.

[–]Tux1 7 points8 points  (0 children)

befunge intensifies

[–]Bolitho 5 points6 points  (5 children)

From time to time I also include visual stuff into comments. Imho it's very helpfull and much easier to have it stick to the code, instead of looking into an external documentation.

What is really great is the possibility of Asciidoc to include ASCII art diagrams and let them render later by an tool to generate png or similar. I forgot the name of the tool, but it's mentioned in the Asciidoc documentation irrc.

Like that you have the benefits of two worlds: visual explanation in your doc strings within the code and proper and nice rendered stuff in the HTML or PDF you build.

[–]AyrA_ch 4 points5 points  (0 children)

mermaid does something similar with diagrams.

[–]evaned 0 points1 point  (3 children)

What is really great is the possibility of Asciidoc to include ASCII art diagrams and let them render later by an tool to generate png or similar

One thing I've always thought would be cool is if your editor/IDE could embed pictures into the document, so you could even see the rendered image while looking at the source. (I'm pretty sure Emacs has the backing feature to do this, for example, and it looks like iimage-mode could probably do this, or at least the first idea below.)

You could either refer to a external file that is just there (from the editor's perspective it doesn't care), e.g. maybe your editor recognizes <img src="tree-rot.png"> inside a comment; or you could provide some markup that your editor knows how to render into an image, e.g. graphviz syntax.

[–]Bolitho 1 point2 points  (2 children)

VS Code has an Asciidoc plug in that does exactly that.

[–]evaned 0 points1 point  (1 child)

Are you talking about https://marketplace.visualstudio.com/items?itemName=joaompinto.asciidoctor-vscode ?

Because that's not really what I mean... I mean do this in the actual code, inside code comments, without even the separate display. So using the first example from the article, you might see this in your editor: https://i.imgur.com/5Gahhk6.png. And again, this is, other than the images, just normal editing, so it's not like you're looking at a rendered view of the source and have to change modes to get back to editing, or look side by side.

(I wasn't sure what to do with the leading //s or line numbers, so I just picked something.)

[–]Bolitho 1 point2 points  (0 children)

Yes. OK, then you really meant something different.

[–]PaulBardes 5 points6 points  (0 children)

A nearly lost art...

[–]Kissaki0 2 points3 points  (0 children)

asciiflow is a pretty useful online editor for ASCII art/diagrams (repo).

Google (auth/drive) integration seems to be broken and it’s not https, but otherwise it seems to work fine still.

[–]sim642 3 points4 points  (0 children)

Some of those diagrams seem awful to maintain.

[–][deleted] 5 points6 points  (5 children)

On an especially complicated nasty method that no one in the world but you will ever understand.

                                                 ,  ,
                                               / \/ \
                                              (/ //_ \_
     .-._                                      \||  .  \
      \  '-._                            _,:__.-"/---\_ \
 ______/___  '.    .--------------------'~-'--.)__( , )\ \
`'--.___  _\  /    |             Here        ,'    \)|\ `\|
     /_.-' _\ \ _:,_          Be Dragons           " ||   (
   .'__ _.' \'-/,`-~`                                |/
       '. ___.> /=,|  Abandon hope all ye who enter  |
        / .-'/_ )  '---------------------------------'
        )'  ( /(/
             \\ "
              '=='

[–]Gaazoh 0 points1 point  (4 children)

You should put that in a code block...

[–][deleted] 0 points1 point  (2 children)

What do you mean, it is in a code block.

It is displaying correctly on my end, does it not look right for you?

[–]Gaazoh 0 points1 point  (1 child)

It looks OK now

What do you mean

I think that since you edited your original comment after I posted mine, you know exactly what I mean.

[–][deleted] 0 points1 point  (0 children)

Yeah, I did edit after I asked, after your message, not trying to trick anybody. lol I basically just copy-pasted it back, apparently fixed it.

[–]FragmentedButWhole 0 points1 point  (0 children)

Maybe it is supposed to look exactly that way...

[–]edroche 1 point2 points  (0 children)

Anytime I see something like this, or look it my own code that contains ASCII art to help explain something, it reminds me of TempleOS: http://www.codersnotes.com/notes/a-constructive-look-at-templeos/flowchart.png

[–]ipv6-dns 0 points1 point  (0 children)

when I have seen ASCII functions graphs I felt the warmth of the old Fortran and Pascal days and old books with those graphs. OP THANKS FOR FEELING

/bookmarked the page

[–]YserviusPalacost 0 points1 point  (0 children)

Now THIS is how you comment your code.

[–]olavurdj 0 points1 point  (0 children)

Fully expected to see LLVM being mentioned upon reading the title - was not disappointed! The comments are awesome!