News for hackers. Stuff that matters.
Re:A look at Unison: a revolutionary programming language by lib-dev on Wednesday January 11, 2023 @02:08AM (#34335899)
Could this be done in other languages too?
Re:A look at Unison: a revolutionary programming language by pharmakom on Wednesday January 11, 2023 @02:38AM (#34336065)
This is one of things Bazel tries to do.
Re:A look at Unison: a revolutionary programming language by brabel on Wednesday January 11, 2023 @02:25AM (#34335997)
kind of. For example, in Java, build tools will normally cache the hash of the source file that generated a class file. That class file is a cached version of the source, basically. IF you could keep both the class file and the hashes of the source around, you could avoid ever re-compiling the source unless you've changed it. This is just incremental compilation, in essence.

However, you'll need quite a lot of tooling around this simple idea: where to store the class files and the hashes, should you commit it into source control, how to distribute the cache, can this be made multi-platform so it works on all developers' machines?

All solvable, but Unison already does all that, and more, with its single tool, the `ucm`.

Re:A look at Unison: a revolutionary programming language by sparkie on Wednesday January 11, 2023 @07:36AM (#34337696)
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. I'm not sure if, and if so, how, it would support mutually recursive functions or data types though. 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, 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.

Re:A look at Unison: a revolutionary programming language by fwip on Wednesday January 11, 2023 @04:41PM (#34345334)
Unison does allow mutually recursive functions.

https://www.unisonweb.org/docs/faq/#how-does-hashing-work-fo...