Please note: This master’s thesis presentation will take place in DC 2314 and online.
Amirhossein Pashaeehir, Master’s candidate
David R. Cheriton School of Computer Science
Supervisor: Professor Ondřej Lhoták
Rust has become one of the most popular languages for systems programming. This popularity is largely driven by Rust’s ability to provide safe static memory management without garbage collection, eliminating GC-induced pauses and runtime overhead that can be difficult to predict and control. In addition, Rust enforces alias and mutability control through its ownership and borrowing discipline, enabling features such as fearless concurrency and stronger compiler optimizations while preserving memory safety. Scala Native brings Scala to systems-level targets by compiling to LLVM IR. However, it still relies on third-party garbage collectors for memory management and does not provide Rust-style static guarantees for safe memory management, aliasing, and mutability control.
This thesis presents imem, a library that brings Rust-inspired ownership and borrow checking to Scala, and Scinear, a minimal compiler plugin that adds linear types to Scala and integrates them with capture checking and polymorphism. imem proves that, given Scala's type system, linearity is the only missing ingredient needed to implement most of Rust's ownership and borrowing discipline as a library rather than a dedicated language feature. imem provides linear Box values and immutable and mutable references, enforces ownership rules, and statically controls aliasing and mutability, following the Stacked Borrows model. In addition, imem offers optional runtime verification to detect potential safety violations when users apply workarounds to the static rules.
To demonstrate practicality, the thesis develops a safe linked-list case study and compares imem against Rust, vanilla Scala, and linear Scala. The evaluation shows that imem matches Rust’s level of expressiveness, so it can support list operations and iterators alongside statically enforcing ownership rules and controlling mutability.
To attend this master’s thesis presentation in person, please go to DC 2314. You can also attend virtually on Google Meet.