"Are there any languages with transactions as a fi...
# thinking-together
s
"Are there any languages with transactions as a first-class concept?" https://www.reddit.com/r/ProgrammingLanguages/comments/10gylhm/are_there_any_languages_with_transactions_as_a/ Would be interested to hear the thoughts of folks here on this thread.
a
"SQL" is not the answer the poster wanted, but arguably the correct one. :D Transactions do figure into my thoughts about language design, and OS/HCI design in general, but I haven't clarified it enough to talk much about it. I'm also very interested in the community's thoughts here.
m
Clojure and Haskell with Software Transactional Memory?
j
The "predict the effect of this code without running this code" aspect of some of the examples runs afoul of the Halting Problem in the general case. 🤷🏻‍♂️
w
Would multiparty session types fit the bill here?
a
I remember rollbacks being a part of one of the VPRI languages.
I have no thoughts, only links.
m
Storage Combinators don’t have transactions built-in per-se, but allow for something that’s even better, IMHO: you can build them yourself and then integrate the result into the language in such a way that it is indistinguishable from being built in. At least I am pretty sure it could be done, as I haven’t built that particular piece yet.
s
I'm very interested in the idea of transactions within a programming language, but I can see some immediate problems with naive approaches (e.g. an error that causes a rollback can't simply apply to the entire program memory or the program would "forget" the error and try it again). So it seems like one would need to add some new system of defining boundaries in which transactions take place and ways of initiating actions or dealing with rollbacks from outside which raises a lot of questions. There's also the issue of state connected to the program in various ways (e.g. sockets, user input) for which rollback is problematic.
w
Ultimately you need rollbacks where the user is in the loop. I suppose this feature is usually called Undo, and the fancy version is called Version Control. 🐺