3 ms·
There are many great ideas in his OS and programming language. One idea I miss very often while programming: embed info like pictures in your code (as comment)
by thdrdt 6y ago
There are many great ideas in his OS and programming language.
One idea I miss very often while programming: embed info like pictures in your code (as comment).
It would be great to add flowcharts, diagrams, screenshots into code as comments (an IDE could collapse this as needed).
Does anyone know if there are languages that also can do this?
- throwaway744678 6y agoI sometimes embed plantuml diagrams in comments; your IDE of choice might have a plug-in to render the diagram (Jetbrains IDEs do)
- thdrdt 6y agoAh wow, I never heard of this. Just installed PlantUML into Jetbrain's Rider and it works great.
- srgpqt 6y agoSeems like this could be achievable in any language with a special doc comment notation that supports image references similar to Markdown.
- zozbot234 6y agoDoc comment notation is not a language concern. You could simply start writing Markdown with image references and if your documentation generator supports it and can resolve these refs, they'll be included. A different approach is to use a literate programming tool like NoWEB in which case the code is included as part of the documentation, and extracted separately.
- diath 6y agoYou could probably embed images in language comments as base64 and then have a plugin for your favorite text editor that renders those (which would probably be easily achievable with Electron-based editors, not so much in others). Even then, that would be a bit of a pain in the ass since other people would just see long strings. I don't think I can name a single language/technology that does it out of the box though.
- paulfurtado 6y agoThis actually exists in Racket and the DrRacket IDE for it. You could actually even use images as variable names, so back in school there was a funny lesson where the professor used the image of a sailboat as a variable name everywhere and joked "why wouldn't you be able to?"
- Koshkin 6y agoI think this is an extension of the idea behind "literate programming," whereby the program code is just a part of a larger text designed for reading by humans in the first place. (This is opposite to embedding comments in code.)