"Coherence" - a Trellis-like language w/error handling
"P.J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> Fri, 24 Apr 2009 14:04:04 -0400
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
I ran across this yesterday, via reddit: http://coherence-lang.org/ The paper is very much worth reading, although I am still digesting all the ramifications of it. Basically, the author has created a Trellis-like programming language, but with various additional twists. In particular, it supports "micro-transactions" at a finer grain than the Trellis, as well as what might be called "structural transactions" for error handling. There is a notion in this language of "fences" and "latches" which can wrap an object such that if an error occurs as a result of changes passing through the "fence", then all changes inside the fence are rolled back to the corresponding latches where those changes were made. However, the boundary isn't a call stack like try/except, it's the attributes or cells where the changes are made. In effect, it's like the old idea of having an "editor" or "buffer" object that holds changes to be applied all-at-once to another object, except that instead of using validation functions on the editor/buffer, this actually works by changing the target object, but rolling back all the changes if an error occurred as a result of any of the changes. In addition, it has the notion of "hypothetical execution", meaning that you can do something like, "suppose I set this and this and this... what would happen?" In other words, a mini-transaction that gets rolled back after you get your information. There's also "causal error handling", which basically means that you can get the equivalent of tracebacks between rules, when something makes something else blow up. Anyway, these features aren't going to show up in Trellis any time soon, but it's interesting to see how someone else has solved similar problems, and I definitely want to study this more.