Design and Evaluation of Coconut: Typestates for C++

This paper introduces Coconut, a C++ tool that uses templates for defining object behaviours and validates them with typestate checking. Coconut employs the GIMPLE intermediate representation (IR) from the GCC compiler’s middle-end phase for static checks, ensuring objects follow valid state transitions as defined in typestate templates. It supports features like branching, recursion, aliasing, inheritance, and typestate visualisation. We illustrate Coconut’s application in embedded systems, validating their behaviour pre-deployment. We present an experimental study, showing that Coconut improves performance and reduces code complexity wrt the original code, highlighting the benefits of typestate-based verification.

Authors

Institutions

Publication Details

Journal
Science of Computer Programming
Published
2025-10-25
DOI
https://doi.org/10.1016/j.scico.2025.103398
Citations
1
Primary Topic
Real-Time Systems Scheduling
Type
article
Field-Weighted Citation Impact
2.27

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Design and Evaluation of Coconut: Typestates for C++

Ornela Dardha, Simon J. Gay, Arwa Hameed Alsubhi
1 citations
Science of Computer Programming
Real-Time Systems Scheduling
2.27
article

Design and Evaluation of Coconut: Typestates for C++

Ornela Dardha, Simon J. Gay, Arwa Hameed Alsubhi
article en
1 citations

Abstract

This paper introduces Coconut, a C++ tool that uses templates for defining object behaviours and validates them with typestate checking. Coconut employs the GIMPLE intermediate representation (IR) from the GCC compiler’s middle-end phase for static checks, ensuring objects follow valid state transitions as defined in typestate templates. It supports features like branching, recursion, aliasing, inheritance, and typestate visualisation. We illustrate Coconut’s application in embedded systems, validating their behaviour pre-deployment. We present an experimental study, showing that Coconut improves performance and reduces code complexity wrt the original code, highlighting the benefits of typestate-based verification.

Science of Computer ProgrammingVol. 250
University of Glasgow (GB)
Saudi Arabia Cultural Bureau in London, Engineering and Physical Sciences Research Council
Openalex Percentile: Top 11%
Real-Time Systems Scheduling
2.27
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.