Abstract

This article presents the design of a library for attaching and checking executable contracts to code written in the Elixir programming language. In addition to classical contract constructs such as preconditions and postconditions, the library allows specifying exceptional behavior (i.e., which exceptions are thrown and under which conditions), detecting non-termination issues in recursive functions by specifying a strictly decreasing order in function arguments, and associating timers with function calls to detect slow computations. The library also focuses on language-specific features, enabling the association of contracts with the reception of messages sent by processes and the attachment of constraints to variable names (useful due to variable shadowing in Elixir). Moreover, stateful contracts (i.e., with a model state) permit specifying the behavior of stateful APIs whose operations can be linearized. Using the stateful contracts, a monitor can be employed to check that the observed state can be explained in terms of possible linearizations.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.