2 ms·
An issue with many languages is the presence of mutually dependant parts of code, because how do you generate a content-hash for something whose constituent par
by sparkie 4y ago
An issue with many languages is the presence of mutually dependant parts of code, because how do you generate a content-hash for something whose constituent part's content-hashes depend on it? Merkle trees can be generalized to DAGs, but not directed graphs with cycles.
As far as I understand, Unison's syntax has been designed specifically to avoid such cycles, although it supports recursive functions and inductive data types which refer to themselves such as lists. A self-cycle can be handled, but I'm not sure if, and if so how, it would support mutually recursive functions or data types. I suspect they're not supported for the reason that content-hashing becomes non-trivial.
If you wanted to generalize the solution to arbitrary languages, you would need to somehow sever the cycles, which is likely to require a specific solution for each language, or come up with another solution to content-hashing which does not have the problem of Merkle-DAGs. Either way, you are looking at something non-trivial compared to having a language which simply forbids the cycles.
- fwip 4y agoUnison does allow mutually recursive functions. https://www.unisonweb.org/docs/faq/#how-does-hashing-work-for-mutually-recursive-definitions https://www.unisonweb.org/docs/faq/#how-does-hashing-work-fo...