Proceedings of ISP RAS

Refinement Types in Jolie

Alexander Tchitchigin (Innopolis University, Innopolis, Russia)
Larisa Safina (Innopolis University, Innopolis, Russia)
Mohamed Elwakil (Innopolis University, Innopolis, Russia)
Manuel Mazzara (Innopolis University, Innopolis, Russia)
Fabrizio Montesi (Innopolis University, Innopolis, Russia)
Victor Rivera (Innopolis University, Innopolis, Russia)


Jolie is the first language for microservices and it is currently dynamically type checked. This paper considers the opportunity to integrate dynamic and static type checking with the introduction of refinement types, verified via an SMT solver. The integration of the two aspects allows a scenario where the static verification of internal services and the dynamic verification of (potentially malicious) external services cooperate in order to reduce testing effort and enhance security.
Refinement types are well-known technique for numeric, array and algebraic data types. They rely on corresponding SMT-theories. Recently SMT solvers got support for a theory of strings and regular expressions. In the paper, we describe possible application of the theory to string refinement types. We use Jolie programming language to illustrate feasibility and usefulness of such extension. First, because Jolie already has syntax extension to support string refinements. We build on top of that extension to provide static type checking. Second, because in the realm of microservices the need for improved checking of string data is much higher as most of external communication goes through text-based protocols.
We present simplified but real-world example from the domain of web-development. We intentionally introduce a bug in the example demonstrating how easily it can slip a conventional type system. Proposed solution is feasible, as it do not accept program with the bug. Complete solution will need enhancements in precision and error reporting.


Microservices, Jolie, Refinement Types, SMT, SAT, Z3


Proceedings of the Institute for System Programming, vol. 28, issue 2, 2016, pp. 33-44.

ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).

DOI: 10.15514/ISPRAS-2016-28(2)-2

Full text of the paper in pdf Back to the contents of the volume