Earlier quoted context omitted.
I really hope that "--->8---" catches on here as a way to quote an extract from something nicely :)
The actual size may change a lot depending on the font, but there’s a nice Unicode symbol for that: ——— ——— Update: apparently HN doesn’t like some characters… Anyway these are the characters: https://unicode.org/charts/nameslist/n_2700.html - 2700 Black Safety Scissors - 2701 Upper Blade Scissors - 2702 Black Scissors - 2703 Lower Blade Scissors - 2704 White Scissors
Literate Programming: Articles
21–30 of 73 posts
Re: Literate Programming: Articles
#22Re: Literate Programming: Articles
#23[flagged]
Re: Literate Programming: Articles
#24I recently tried Literate Programming and I've found that it has some downsides not commonly discussed by its advocates. (It also has upsides which are valid, this post may come across as overly negative because I'm only covering negatives.) * It messes with tooling. If you're lucky then your editor will be smart enough to syntax highlight inside code blocks, or can be taught to do so easily. It's unlikely that more…
>* The "includes" problem. Most language require you to include/import/require packages used in a file. These are usually all placed at the start. This means a lot of chapters will start with "here are all the includes we'll need" if you're using a linear format. More complex formats that rearrange the code to generate outputs can do a better job but it's still a little clunky. Real literate programming, rather than…
And yet Knuth still does it the other way. http://akkartik.name/post/literate-programming>
Re: Literate Programming: Articles
#25It might be nice if modern languages defined an official way to "flip" the interpretation of a source file, so that by default the content is treated as markdown and the code goes in fenced blocks (rather than defaulting to code and providing a way to mark comment blocks). Then we might hope for support in most tooling to appear quite quickly. I think one reason why literate programming is less attractive nowadays (c…
Every language with block comments supports this, by starting the file with a comment and wrapping code in end-comment/start-comment pairs. It's not especially useful. For literate programming you really need the ability to move blocks of code around without the ceremony of function signatures.
[0] https://wiki.haskell.org/Literate_programming#Haskell_and_li...
[1] https://okmij.org/ftp/Haskell/class-based-dispatch.lhs
[2] https://okmij.org/ftp/Computation/lightweight-guarantees/eli...
Re: Literate Programming: Articles
#26The tooling can be a bit clunky -- though JupyterLab and some plugins can go a long way. Importing notebooks into other notebooks or modules is still kind of weird even with the `ipynb` library.
However, on the otherside of it all, you have a collection of documents that contain documentation, code, and tests, all side by side and storable with proof of past execution.
I'll take this arrangement over someone's unit test and CI suite every day of the week.
Re: Literate Programming: Articles
#27I recently tried Literate Programming and I've found that it has some downsides not commonly discussed by its advocates. (It also has upsides which are valid, this post may come across as overly negative because I'm only covering negatives.) * It messes with tooling. If you're lucky then your editor will be smart enough to syntax highlight inside code blocks, or can be taught to do so easily. It's unlikely that more…
I do this with Typescript (deno) and a neovim plugin called sniprun.
Re: Literate Programming: Articles
#28It might be nice if modern languages defined an official way to "flip" the interpretation of a source file, so that by default the content is treated as markdown and the code goes in fenced blocks (rather than defaulting to code and providing a way to mark comment blocks). Then we might hope for support in most tooling to appear quite quickly. I think one reason why literate programming is less attractive nowadays (c…
Re: Literate Programming: Articles
#29Is it "notebook" style programming, like Mathematica, matlab, Jupyter, and markdown-based stuff like R/python + Quarto? In this mode, I think the focus is more on creating a document or communicating stuff typically with data analysis. And actually, "literate" is a very apt adjective for something that's ultimately intended to be a document of some kind.
Or is it more general intended for writing arbitrary software applications and having everything in the source code? In other words, to understand the source, you just read the source and there are no other documents.
The latter mode, I think, is still very much not around as far as I know (academic proof-of-concepts for papers don't count :-) ). Will it ever really exist?
Re: Literate Programming: Articles
#30I think there's some distinctions that need to be made. IMHO, Literate programming can be an umbrella for a bunch of different things. Is it "notebook" style programming, like Mathematica, matlab, Jupyter, and markdown-based stuff like R/python + Quarto? In this mode, I think the focus is more on creating a document or communicating stuff typically with data analysis. And actually, "literate" is a very apt adjective…
There is Stanford GraphBase, and a really good MP3 book that are full programs. Not to mention TeX.