This tangling, does it refer to presenting the code in a different order than the compiler needs it? Because that has always struck me as a limitation of literate programming, that you might want to tell the reader about some basic functions before introducing the full type definitions, for instance.

Tangling refers to the process of taking the markup document of a literate program and converting it to code that a compiler would read.

Weaving refers to the process of taking the same markup document of a literate program, and outputting it to a human readable format (HTML, TeX, etc).

In a full literate program system (such as WEB, CWEB, or Noweb), one can make use of what are referred to as named code blocks (well I call call them that) to write about code out of order. The tangling process then takes those blocks and then stitches them all in the order that the compiler expects.

Hope that makes sense. The wikipedia page on literate programming has more information on the paradigm.

1 Like