xyzzy
03/28/2022, 12:30 AMKonrad Hinsen
03/28/2022, 7:07 AMI think the fundamental mistake that people seem to be making with LP is using it to describe algorithms rather than code history, code inspirations, bug stories, features and any other context surrounding code like tests / security.This sounds a bit strange to me. The original goal of literate programming, as introduced by Donald Knuth, was to formulate algorithms in a pedagogical way. I wouldn't call that goal a mistake. Maybe literate programming is not the best way to achieve it, but then... what is? That said, I am perfectly fine with your approach, which is more in line with the various notebooks that have appeared over the last years. From my perspective as a long-time user of Emacs-plus-org-mode, I'd say you are doing org-mode with Web technology. But I think this approach misses something essential: the algorithms on which all the high-level stuff ultimately depends. I want those algorithms to be just as accessible to readers as the high-level outline. With notebooks and friends, they disappear in a black box instead.
Tom Larkworthy
03/28/2022, 8:47 AMxyzzy
03/28/2022, 11:49 AM*<<public declarations>>=*
*void* quicksort(*void* * base, size_t num_elements, size_t element_size,
*int* (*comparer)(*const* *void* *, *const* *void* *));
*<<quicksort>>=*
*void* quicksort(*void* * base, size_t num_elements, size_t element_size,
*int* (*comparer)(*const* *void* *, *const* *void* *))
*{*
<<quicksort declarations>>
<<check termination condition>>
<<select a pivot>>
<<partition the array>>
<<recursively sort each subpartition>>
*}*
I would basically avoid declaration chunks like the above snippet ... unless its really a complex algorithm. Most everyday code in apps is far too simple to warrant such detail.Tom Larkworthy
03/28/2022, 12:51 PMKonrad Hinsen
03/28/2022, 4:33 PMquicksort
. As a reader, I want to figure out what it does.
First step: look up the code that is actually called. That's your step 7, and should be trivial, which it is in a good IDE but (so far) it is not in notebook-like environments. The only other piece that a code analysis could lead to is unit tests (your step 2).
Everything else would be annotations added by the developer, so now we are in the "documentation" category. Donald Knuth's prose gets complemented by other media, links to Wikipedia, etc. All the niceties that didn't exist at Knuth's time. But that's just a technology update, not a fundamental improvement compared to the LP of the past.xyzzy
03/28/2022, 5:54 PMTom Larkworthy
03/29/2022, 7:54 AMxyzzy
03/29/2022, 11:16 AM