Literate icon indicating copy to clipboard operation
Literate copied to clipboard

Can we backport patches from program sources to literate sources?

Open gunnihinn opened this issue 4 years ago • 0 comments

Suppose we have a program written in Literate, and some collaborators on that program who, for whatever reason, only want to work on the generated program source files. This could happen when working on a literate project in a large company, or when trying to port an existing project into Literate while it still receives patches.

We have ways of pointing compiler errors in the generated sources back to the literate sources. Is it feasible to similarly backport the output of diff on a generated source back to the literate sources?

For example, suppose we have a literate source L from which we generate a program source file S. We modify S and obtain S'. Running diff(S, S') gives us patches P_1, ..., P_n that we can apply to S with patch to obtain S'. Is it possible to "lift" the patches P_j to the literate source L to get patches P'_1, ..., P'_n that give us a literate source L' that generates S'?

In wonky math speak, generating the sources is a function f : L -> S and we have a function patch : S -> S'. Can we always lift it automatically to L -> L' such that the diagram

L --> L'
|     |
v     v
S --> S'

commutes?

If so, contributors or coworkers can remain ignorant of Literate and we can easily benefit from their contributions.

gunnihinn avatar Jun 04 '20 08:06 gunnihinn