Scala-Mungo

Abstract

In programming languages nowadays, the concept of data types is prevalent and helpful in ensuring that code executes properly. Programmers will often be forced to pick a datatype for their variables and only allowed certain operations on them. However, when a programmer wishes to create code which should behave according to a set of rules (a protocol), there is no way of ensuring that the protocol is well followed by assigning a datatype. Since inspection is a costly and often ineffective way of removing errors, an automated approach is desired, which is where typestates prove useful. Typestates enable each class in a program to have a protocol attached to it. The program can then be checked at compile time for protocol violations. This report presents Scala-Mungo, which is a tool which incorporates typestates into Scala. It is heavily inspired by Mungo, a similar tool for Java. Scala-Mungo is the first typestate tool to implement unrestricted aliasing. This enables users to use aliases freely in their code, without losing the ability to check their code for protocol errors. The implementation relies on a global approach to tracking instances. The results of user testing show that Scala-Mungo is user-friendly, intuitive, and mostly bug-free. However, some alterations and a more expansive evaluation should be undertaken before it is released to the public

Publication
Master Thesis

Related