My impression of Unison is that if you want to call a function ten times, you just need to evaluate that code into an AST once. Once you have the hash of that AST, you can delete the code and still call the function 9 more times without having to bother with building the tree each time.
I don't know what to call it, but I don't think it's interpreted because you don't need the code to run it (except the first time, which is how you know find the hash of the function).
This is not the case even in an interpreted language. You only need to build an AST once, at parse time. In JavaScript the AST is then compiled into byte code or machine code depending on the implementation.
In JS, if 1 developer and 9 users with a total of 10 separate browser instances all call the same function, the code will be parsed 10 times.
In Unison, the AST is generated by the developer, cached, and the 9 users can call it by hash (assuming they have access to that database where the AST lives) without reparsing the code.
The way I intend to use it is that users periodically fetch the codebases from all of the developers that they trust. This has no immediate effect because you're still calling the same function that you're used to. So the sync can be very latency tolerant.
Then, when you decided to use the new version of something, you call the new hash. If something goes wrong, you just go back to calling the old hash--atomic upgrade/downgrades, no merge conflicts.
But if your idea of writing software involves:
* type checking, linting and otherwise ensuring properties of the code before even running it.
* testing code before deploying it.
* turning it from text into a representation that's more compact and safer to run.
* generating documentation.
Then you'll definitely need a build, and a very complex one for that matter, in JS world. Have you ever seen a JS project without any sort of build in a professional context?
And you'll need a big IDE to help you make sense of anything because JS doesn't even have a "compiler" or "helper tool" that'll give you any help to navigate and understand the code base.
Imagine a world that pre-dates typescript, node, webpack, browserify, gulp, grunt. You were lucky if you had a server framework that concatenated files for you, otherwise you were stuck with 6000+ line "global.js" files. Then you had to fix merge conflicts in that file because SVN.
Whenever someone complains that frontend JS is too much, I just think back to how it used to be.
I can see this being useful for implementing alternative editing interfaces besides just writing code textually. For example, flow-based visual programming or something like that. Adding and connecting nodes in a visual interface would each be small updates to the database, and then there would never be a "build step" because the database you've been editing is already the AST that could either be interpreted or compiled. So it only really does away with the parser, but that doesn't seem revolutionary to me, other languages can already do that. I might be missing something still.
So for example if someone publishes a library, no new build step would ever be required for consumers of that library.
Even with CI/CD there would be no build step because the very act of merging one's code into another codebase operates on canonical representations and so they never need to be regenerated.
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`.
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.
https://www.unisonweb.org/docs/faq/#how-does-hashing-work-fo...
The model also precludes cross-unit optimizations so there's a performance upper bound on compilation model that leaves it in the middle tier of performance without the model being broken (given things we've seen before).
That's not very different from using ccache. Claiming that there are no builds is simply not true.
> So for example if someone publishes a library, no new build step would ever be required for consumers of that library.
Does that require trusting compiled blobs from 3rd parties? That could make it trivial to inject backdoors.
> It has a canonical representation for all code,
Isn't generating that canonical representation the build step?
> The important thing is that now, I can actually compile and run this program
Now I'm confused whether there is or isn't a build step.