3 ms·
This can (and has) been done but sooner or later you step on a landmine package for which this is not possible (reliably patching the output), so you end up reb
by xyzzy_plugh 3y ago
This can (and has) been done but sooner or later you step on a landmine package for which this is not possible (reliably patching the output), so you end up rebuilding (reliably patching the input) and now you're inevitably rebuilding the entire world. It would've been easier to just do that in the first place.
That being said I've long suspected there is a happy middle ground where you hack at the problem from both sides. On one side you provide F(x) -> x' where x is an absolute path closure and x' is a relative path closure, for any supported subgraphs in the build graph. Then, for the rest, you rebuild from source using any transformed inputs you can. In other words, when you're evaluating x', if you have x in a cache already, and you can rewrite it, do so. If not, just build it from scratch.
The problem is at some point you have to prove that both methods of producing x' result in the same exact output. This is not easy! However you can possibly prove it for any arbitrary closure by simply round tripping. For example, assuming the transform F(x) -> x' is cheap, and at some point you build x, which is almost guaranteed, then allow x'' == x and when you build x just try and retarget it anywhere, and then back again.
This doesn't prove it actually works, but might prove that it's correct, which is acceptable to me. I haven't got far enough to try this out yet, of course. Be my guest!