Research

Paper

TESTING March 05, 2026

JoinActors: A Modular Library for Actors with Join Patterns

Authors

Ayman Hussein, Philipp Haller, Ioannis Karras, Hernán Melgratti, Alceste Scalas, Emilio Tuosto

Abstract

Join patterns are a high-level programming construct for message-passing applications. They offer an intuitive and declarative approach for specifying how concurrent and distributed components coordinate, possibly depending on complex conditions over combinations of messages. Join patterns have inspired many implementations -- but most of them are not available as libraries: rather, they are domain-specific languages that can be hard to integrate into pre-existing ecosystems. Moreover, all implementations ship with a predefined matching algorithm, which may not be optimal depending on the application requirements. These limitations are addressed by `JoinActors`, a recently published library which integrates join patterns in the off-the-shelf Scala 3 programming language, and is designed to be modular w.r.t. the matching algorithm in use. In this work we address the problem of designing, developing, and evaluating a modular join pattern matching toolkit that (1) can be used as a regular library with a developer-friendly syntax within a pre-existing programming language, and (2) has an extensible design that supports the use and comparison of different matching algorithms. We analyse how `JoinActors` achieves goals (1) and (2) above. The paper that introduced `JoinActors` only briefly outlined its design and implementation (as its main goal was formalising its novel fair matching semantics*). In this work we present and discuss in detail an improved version of `JoinActors`, focusing on its use of metaprogramming (which enables an intuitive API resembling standard pattern matching) and on its modular design. We show how this enables the integration of multiple matching algorithms with different optimisations and we evaluate their performance via benchmarks covering different workloads. We illustrate a sophisticated use of Scala 3's metaprogramming for the integration of an advanced concurrent programming construct within a pre-existing language. In addition, we discuss the insights and "lessons learned" in optimising join pattern matching, and how they are facilitated by `JoinActors`'s modularity -- which allows for the systematic comparison of multiple matching algorithm implementations. We adopt the fair join pattern matching semantics and the benchmark suite from the paper that originally introduced `JoinActors`. Through extensive testing we ensure that our new optimised matching algorithms produce exactly the same matches as the original `JoinActors` library, while achieving significantly better performance. The improved version of `JoinActors` is the companion artifact of this paper. This work showcases the expressiveness, effectiveness, and usability of join patterns for implementing complex coordination patterns in distributed message-passing systems, within a pre-existing language. It also demonstrates promising performance results, with significant improvements over previous work. Besides the practical promise, `JoinActors`'s modular design offers a research playground for exploring and comparing new join pattern matching algorithms, possibly based on entirely different semantics.

Metadata

arXiv ID: 2603.05648
Provider: ARXIV
Primary Category: cs.PL
Published: 2026-03-05
Fetched: 2026-03-09 06:05

Related papers

Raw Data (Debug)
{
  "raw_xml": "<entry>\n    <id>http://arxiv.org/abs/2603.05648v1</id>\n    <title>JoinActors: A Modular Library for Actors with Join Patterns</title>\n    <updated>2026-03-05T19:56:02Z</updated>\n    <link href='https://arxiv.org/abs/2603.05648v1' rel='alternate' type='text/html'/>\n    <link href='https://arxiv.org/pdf/2603.05648v1' rel='related' title='pdf' type='application/pdf'/>\n    <summary>Join patterns are a high-level programming construct for message-passing applications. They offer an intuitive and declarative approach for specifying how concurrent and distributed components coordinate, possibly depending on complex conditions over combinations of messages. Join patterns have inspired many implementations -- but most of them are not available as libraries: rather, they are domain-specific languages that can be hard to integrate into pre-existing ecosystems. Moreover, all implementations ship with a predefined matching algorithm, which may not be optimal depending on the application requirements. These limitations are addressed by `JoinActors`, a recently published library which integrates join patterns in the off-the-shelf Scala 3 programming language, and is designed to be modular w.r.t. the matching algorithm in use.\n  In this work we address the problem of designing, developing, and evaluating a modular join pattern matching toolkit that (1) can be used as a regular library with a developer-friendly syntax within a pre-existing programming language, and (2) has an extensible design that supports the use and comparison of different matching algorithms. We analyse how `JoinActors` achieves goals (1) and (2) above. The paper that introduced `JoinActors` only briefly outlined its design and implementation (as its main goal was formalising its novel fair matching semantics*). In this work we present and discuss in detail an improved version of `JoinActors`, focusing on its use of metaprogramming (which enables an intuitive API resembling standard pattern matching) and on its modular design. We show how this enables the integration of multiple matching algorithms with different optimisations and we evaluate their performance via benchmarks covering different workloads.\n  We illustrate a sophisticated use of Scala 3's metaprogramming for the integration of an advanced concurrent programming construct within a pre-existing language. In addition, we discuss the insights and \"lessons learned\" in optimising join pattern matching, and how they are facilitated by `JoinActors`'s modularity -- which allows for the systematic comparison of multiple matching algorithm implementations. We adopt the fair join pattern matching semantics and the benchmark suite from the paper that originally introduced `JoinActors`. Through extensive testing we ensure that our new optimised matching algorithms produce exactly the same matches as the original `JoinActors` library, while achieving significantly better performance. The improved version of `JoinActors` is the companion artifact of this paper. This work showcases the expressiveness, effectiveness, and usability of join patterns for implementing complex coordination patterns in distributed message-passing systems, within a pre-existing language. It also demonstrates promising performance results, with significant improvements over previous work. Besides the practical promise, `JoinActors`'s modular design offers a research playground for exploring and comparing new join pattern matching algorithms, possibly based on entirely different semantics.</summary>\n    <category scheme='http://arxiv.org/schemas/atom' term='cs.PL'/>\n    <published>2026-03-05T19:56:02Z</published>\n    <arxiv:primary_category term='cs.PL'/>\n    <arxiv:journal_ref>The Art, Science, and Engineering of Programming, 2026, Vol. 11, Issue 1, Article 4</arxiv:journal_ref>\n    <author>\n      <name>Ayman Hussein</name>\n      <arxiv:affiliation>Technical University of Denmark, Denmark</arxiv:affiliation>\n    </author>\n    <author>\n      <name>Philipp Haller</name>\n      <arxiv:affiliation>KTH Royal Institute of Technology, Sweden</arxiv:affiliation>\n    </author>\n    <author>\n      <name>Ioannis Karras</name>\n      <arxiv:affiliation>Technical University of Denmark, Denmark</arxiv:affiliation>\n    </author>\n    <author>\n      <name>Hernán Melgratti</name>\n      <arxiv:affiliation>University of Buenos Aires, Argentina / CONICET, Argentina</arxiv:affiliation>\n    </author>\n    <author>\n      <name>Alceste Scalas</name>\n      <arxiv:affiliation>Technical University of Denmark, Denmark</arxiv:affiliation>\n    </author>\n    <author>\n      <name>Emilio Tuosto</name>\n      <arxiv:affiliation>Gran Sasso Science Institute, Italy</arxiv:affiliation>\n    </author>\n    <arxiv:doi>10.22152/programming-journal.org/2026/11/4</arxiv:doi>\n    <link href='https://doi.org/10.22152/programming-journal.org/2026/11/4' rel='related' title='doi'/>\n  </entry>"
}