Skip to content

jswalens/chocolalib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chocola

Chocola – composable concurrency

Chocola is a Clojure library for concurrent and parallel programming. It provides futures, transactions, and actors. It is unique in ensuring that these three models work correctly even when they are combined.

You can find more information and code examples at https://chocola.jnwllm.be/.

Getting started

Because this library monkey-patches Clojure, it is a bit complicated to get working: we need to make sure it is loaded before Clojure, i.e. the Chocola jar must appear earlier in the classpath than Clojure. Assuming you use Leiningen, you can follow these steps:

  1. In a temporary folder, checkout this repository and create the 'uberjar':
$ git clone https://github.com/jswalens/chocolalib.git
$ lein uberjar

This creates the file target/chocola-2.0.1-standalone.jar, which contains Clojure 1.10.1, Chocola, and its dependencies (core.match).

  1. Copy this file into the resources folder of your project. (The folder can have another name too.)

  2. Update your project's project.clj to add the following lines:

  :resource-paths ["resources/chocola-2.0.1-standalone.jar"]
  :injections [(require 'chocola.core)]

The first line will make sure that Chocola and its dependencies are loaded. The second line injects a call to include Chocola in your code, which will patch Clojure and modify its internals to use Chocola's semantics.

Some code examples of Chocola can be found at https://chocola.jnwllm.be/.

Publications

We published about (the ideas behind) Chocola in the following academic papers:

You can find a lot more information in my PhD thesis.

If you use this software in an academic context, please cite the following paper:

@article{10.1145/3427201,
    author = {Swalens, Janwillem and {De Koster}, Joeri and {De Meuter}, Wolfgang},
    title = {{Chocola: Composable Concurrency Language}},
    journal = {ACM Transactions on Programming Languages and Systems},
    year = {2021},
    month = jan,
    volume = {42},
    number = {4},
    articleno = {17},
    numpages = {56},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    issn = {0164-0925},
    doi = {10.1145/3427201},
    url = {https://doi.org/10.1145/3427201},
}

To do

  • Documentation:
    • Check whether getting started always works as expected
    • Add documentation on how to use Chocola and explain its semantics
  • Implementation:
    • Garbage collection of unreachable actors (currently, unreachable actors will stay idle forever)
    • Interaction with exceptions/errors (seems to mostly work correctly, but exhaustive testing is needed)
    • commute (doesn't work as expected in transactional futures)
    • Performance improvements (see TODOs throughout code)

License

Copyright © 2018–2019 Janwillem Swalens, Software Languages Lab, Vrije Universiteit Brussel. Distributed under the Eclipse Public License, included in the file LICENSE.