TY - GEN
T1 - Retrofitting Typestates into Rust
AU - Duarte, José
AU - Ravara, António
N1 - info:eu-repo/grantAgreement/FCT/6817 - DCRRNI ID/UIDB%2F04516%2F2020/PT#
info:eu-repo/grantAgreement/EC/H2020/778233/EU#
PY - 2021/9/27
Y1 - 2021/9/27
N2 - As software permeates our lives, bugs become increasingly expensive; the best way to reduce their cost is to reduce the number of bugs. Of course, this is easier said than done and, at best, we can go after their root causes to mitigate them. One of such causes is state, whether it is the state of a light bulb (i.e. on/off), or the state of a complex protocol, reasoning about state is a complex process which developers are required to do with subpar tools. Ideally, we want to specify constraints and have the computer reason for us; typestates enable developers to describe states using the type system and allow the compiler to reason about them. We propose an approach to bring typestates to Rust, without any external tools, leveraging only Rust's type and macro systems. Our approach provides a macro-based domain-specific language which enables developers to easily express and implement typestates, along with certain state machine safety guarantees, it is open-source and available at https://github.com/rustype/typestate-rs.
AB - As software permeates our lives, bugs become increasingly expensive; the best way to reduce their cost is to reduce the number of bugs. Of course, this is easier said than done and, at best, we can go after their root causes to mitigate them. One of such causes is state, whether it is the state of a light bulb (i.e. on/off), or the state of a complex protocol, reasoning about state is a complex process which developers are required to do with subpar tools. Ideally, we want to specify constraints and have the computer reason for us; typestates enable developers to describe states using the type system and allow the compiler to reason about them. We propose an approach to bring typestates to Rust, without any external tools, leveraging only Rust's type and macro systems. Our approach provides a macro-based domain-specific language which enables developers to easily express and implement typestates, along with certain state machine safety guarantees, it is open-source and available at https://github.com/rustype/typestate-rs.
KW - Behavioral Typing
KW - Domain-specific Languages
KW - Macros
KW - Protocol Compliance
KW - Rust
KW - Session Types
KW - Typestates
UR - http://www.scopus.com/inward/record.url?scp=85117345714&partnerID=8YFLogxK
U2 - 10.1145/3475061.3475082
DO - 10.1145/3475061.3475082
M3 - Conference contribution
AN - SCOPUS:85117345714
T3 - ACM International Conference Proceeding Series
SP - 83
EP - 91
BT - CBSOFT 2021 - Brazilian Conference on Software; Proceedings - 25th Brazilian Symposium on Programming Languages, SBLP 2021
PB - ACM - Association for Computing Machinery
T2 - 25th Brazilian Symposium on Programming Languages, SBLP 2021, held in conjunction with the Brazilian Conference on Software: Theory and Practice, CBSoft 2021
Y2 - 27 September 2021 through 1 October 2021
ER -