Master’s Thesis Presentation • Programming Languages • Adding Reference Immutability to Scala

Monday, June 26, 2023 11:00 am - 12:00 pm EDT (GMT -04:00)

Please note: This master’s thesis presentation will take place in DC 3317.

Yaoyu Zhao, Master’s candidate
David R. Cheriton School of Computer Science

Supervisor: Professor Ondřej Lhoták

Scala is a multi-paradigm programming language combining the power of functional and object-oriented programming. While Scala has many features promoting immutability, it lacks a built-in mechanism for controlling and enforcing reference immutability.

Reference immutability, which guarantees that an object and other objects reachable from it cannot be mutated through an immutable reference, is a key aspect of immutability in object-oriented programming languages.

This thesis presents a system for reference immutability in Scala, along with a simple implementation in the Dotty (Scala 3) compiler. By extending the Scala type system and encoding mutability as types within annotations, my system enables tracking and enforcing reference immutability for any type. It addresses challenges such as the complexities of the Scala type system and context sensitivity with nested classes and functions. The design offers binary compatibility with existing Scala code, and promotes predictable object behavior, reducing the risk of bugs in software development.