Unison programming language and hashed semantics

61 views
Skip to first unread message

Brandon Barker

unread,
Aug 9, 2019, 9:36:47 PM8/9/19
to ats-lang-users
Unison (not to be confused with Unisom, which I sometimes take if sleep eludes me) is a rather interesting, currently-alpha, Haskell-like language. One of the more interesting bits for ATS3 seems to be their approach for how code is stored and transmitted:



This dynamic transfer / deployment of arbitrary computations is possible because definitions in Unison are identified by a cryptographic hash of their content, including the hashes of all dependencies (the hash is also "nameless" as it isn't affected by naming of variables). To transfer a computation, we send it to the recipient, and the recipient checks to see if the computation references any unknown hashes. Any unknown hashes are synced to the recipient before the transfer completes and the computation proceeds.

So textual references (names) are just aliased to, I suppose, the actual semantic meaning of the underlying code, and are stored separately:

To make this happen, Unison just changed the name associated with the hash of foldl in one place. The view command just looks up the names for the hashes on the fly, right when it’s printing out the code.
This is important: Unison isn’t doing a bunch of text mutation on your behalf, updating possibly thousands of files, generating a huge textual diff, and also breaking a bunch of downstream library users who are still expecting that definition to be called by the old name. That would be crazy, right?
So rename and move things around as much as you want. Don’t worry about picking a perfect name the first time. Give the same definition multiple names if you want. It’s all good!
☝️ Using alias.term instead of move.term introduces a new name for a definition without removing the old name(s).
 

I think there was some discussion on the list previously about doing ATS3 in a non-textual fashion, but I couldn't quickly find the reference. 
Reply all
Reply to author
Forward
0 new messages