Nbdev and literate programming what is it missing

I’ve read that nbdev brings “true literate programming” to jupyter notebooks. I am a user of other literate programmings systems (cweb, SWeave, noweb…) and I find this affirmation really appealing.

But, the reality is shorter or smaller than that affirmation. The article https://www.perl.com/pub/tchrist/litprog.html/ talks about how POD (Perl documentation system) do not qualify to be literate programming and by its rules nbdev doesn’t qualify either. The article exposes 3 requisites to considerate a literate programming system: documentation intermixed with code (chunks), chunks can be in any order or be inside other chunks (tangle) and pretty-printing and links between chunks (web, this use of links is before of WWW).

This is almost the same case than nbdev. Nbdev has chunks (I’m not sure about granularity. I think it is not advisable to create chunks smaller than a function definition), pretty-printing and some auto links but it doesn’t have tangle ability.

I think nbdev can’t be named literate programming without tangle habilities. I am not expert in inner works in notebooks and I do not know how to tangle can be done in notebooks. But I missed that feature. Until that point, nbdev is closer to Doxygen (a document generator) than a full literate programming system.

How difficult is it implement tangle abilities?

I’m not a fan of the tangle approach, personally, so I’m not likely to implement it myself. I also don’t think it’s a good fit for the REPL-driven approach of a notebook.

I do agree it’s quite different to something like cweb, but I much prefer it this way. (And of course some people may not, which is fine :slight_smile: )

1 Like