3 ms·
I disagree with the author's interpretation of comments after #include statements being "cruft". For me the intent there was effectively addressing one of c's
by tpoacher 5y ago
I disagree with the author's interpretation of comments after #include statements being "cruft".
For me the intent there was effectively addressing one of c's weaknesses, which is lack of namespaces and clear import statements.
It is the python equivalent of doing
from module import fun1, fun2
instead of
from module import *
such that when the reader encounters fun1 later in the code, a simple glance at the top of the file should make it abundantly clear where fun1 came from, saving you a wild goose chase grepping into your system libraries.
"Oh, but, I can use my super expensive IDE's code-hunting plugin to get a 'where is this defined' popup when I hover with the mouse for a couple of seconds bla bla bla" you might say.
True. But then you'd be missing the whole point of literate programming, and the actual spirit of "you should be able to read the code in bed like a novel", which the author seems to have taken a bit too literally.
To me, literate programming could be effectively reframed as "code that is so self explanatory and clear, even in the presence of complex external dependencies, that it could be easily fixed _in nano_ within seconds, without ever having to go hunting outside that file".
PS: Unrelated to the above rant, on the other hand, some people seem to think that literate programming == jupyter notebooks or more generally the whole "cram everything in a single file and comment heavily to create a report" style of coding. No. In fact, this is as far away from what literate programming is about in spirit as could possibly be.