Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the practical use of an io! block in Clojure?

Tags:

clojure

What would be an example scenario where an io! block would be used in Clojure? I am having troubles understanding its purpose.

like image 566
Aspasia Avatar asked May 22 '17 15:05

Aspasia


1 Answers

It's a part of the STM system for ensuring that code related to IO is not used inside STM transactions. Since clojure will retry a transaction if another thread commits contradictory data while a transaction is running, any IO produced by that transaction would be bogus because it represents a state of memory that could be discarded.

like image 183
Arthur Ulfeldt Avatar answered Nov 09 '22 14:11

Arthur Ulfeldt