Live data from Hacker News

ASCII art for semantic code commenting

asciiflow.com

31–40 of 82 posts

Re: ASCII art for semantic code commenting

#31
I was daydreaming about something like this the other night. This is even cooler than what I was picturing! My only complaint is the download arrow threw me off for a bit, I wanted to copy to clipboard but did not realize that was hidden behind the arrow. Switching that icon to a clipboard that pops the modal might add some clarity.

Re: ASCII art for semantic code commenting

#32

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

I usually copy from wikipedia but that's that's a good idea. In fact, since I have a "cols" command that just prints an ansi-colour table, I've just added "box" to do this.

Re: ASCII art for semantic code commenting

#34

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

Do you have an example context in which you'd use these? I've never thought to do this and am curious about the possibilities and use cases.

Re: ASCII art for semantic code commenting

#35
post #34

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

Do you have an example context in which you'd use these? I've never thought to do this and am curious about the possibilities and use cases.

Sure, last time I used them I documented some file format I needed to reverse engineer.

Here an excerpt. Of course, it's not _necessary_ to do it like that. It's just flavor.

    ┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┳┅┅
    ┃ Chunk 1 Header │ Chunk 1 Body ┃ Chunk 2 Header │ Chunk 2 Body ┃
    ┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┻┅┅

    Chunk Header:
    ┌───────────┬─────────────────┐
    │ Magic Nr. │ Chunk Body Size │
    │   4 Byte  │          4 Byte │
    └───────────┴─────────────────┘

Re: ASCII art for semantic code commenting

#36

I've seen this a few times. The key limit is that once drawn the characters are set, you can't move the drawn objects around. What I'd like is something like drawio for ASCII/Unicode. I've been thinking of writing my own for years, but that'll probably never happen so I'll just keep mentioning the idea when similar apps come up in the hope I inspire someone else!

Hey, maintainer here (sorta). We've both been super absent the last few years unfortunately but this was ultimately on our list for V3.

Now I just need to find some spare time...

Re: ASCII art for semantic code commenting

#37
post #34

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

Do you have an example context in which you'd use these? I've never thought to do this and am curious about the possibilities and use cases.

It's fabulous in cases where there's a "big important business logic" or a "big important test" with tough to eliminate complexity, where you feel a diagram is so important that it's worth putting in comments beside said code. I do recommend that you be careful with this though; in places where it's not common to put ASCII art diagrams in code you'll probably receive pushback (it is afterall very large and distracting compared to said code). Be ready to save an in-code diagram for the 1-to-3 places in the business where they'll be a godsend.

Re: ASCII art for semantic code commenting

#39
It's so nice to see all this interest in ASCII art.

\o/ -huzzah

I still use Jave (http://www.jave.de/#description) occasionally, but it's beginning to show its age. It does have some nice features, though that asciiflow is missing: figlet font support and (gasp) circles!

Some other tools worth mentioning here among aficionados are PIC ( https://en.wikipedia.org/wiki/PIC_(markup_language) ) and of course cowsay. Someone already mentioned plantuml.

Post reply on HN