<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="static/style.xsl"?><OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"><responseDate>2026-11-22T04:47:21Z</responseDate><request verb="GetRecord" identifier="oai:uwspace.uwaterloo.ca:10012/22982" metadataPrefix="dim">https://dspacemainprd01.lib.uwaterloo.ca/server/oai/request</request><GetRecord><record><header><identifier>oai:uwspace.uwaterloo.ca:10012/22982</identifier><datestamp>2026-03-30T19:13:24Z</datestamp><setSpec>com_10012_9924</setSpec><setSpec>com_10012_1</setSpec><setSpec>col_10012_9930</setSpec><setSpec>col_10012_6</setSpec></header><metadata><dim:dim xmlns:dim="http://www.dspace.org/xmlns/dspace/dim" xmlns:doc="http://www.lyncode.com/xoai" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dspace.org/xmlns/dspace/dim http://www.dspace.org/schema/dim.xsd">
   <dim:field mdschema="dc" element="contributor" qualifier="author">Pashaeehir, Amirhossein</dim:field>
   <dim:field mdschema="dc" element="date" qualifier="accessioned">2026-03-30T19:13:23Z</dim:field>
   <dim:field mdschema="dc" element="date" qualifier="available">2026-03-30T19:13:23Z</dim:field>
   <dim:field mdschema="dc" element="date" qualifier="issued">2026-03-30</dim:field>
   <dim:field mdschema="dc" element="date" qualifier="submitted">2026-03-20</dim:field>
   <dim:field mdschema="dc" element="identifier" qualifier="uri">https://hdl.handle.net/10012/22982</dim:field>
   <dim:field mdschema="dc" element="description" qualifier="abstract">Rust has become one of the most popular languages for systems programming. This popularity is largely driven by Rust&amp;apos;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&amp;apos;s type system, linearity is the only missing ingredient needed to implement most of Rust&amp;apos;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&amp;apos;s level of expressiveness, so it can support list operations and iterators alongside statically enforcing ownership rules and controlling mutability.</dim:field>
   <dim:field mdschema="dc" element="language" qualifier="iso">en</dim:field>
   <dim:field mdschema="dc" element="publisher" lang="en">University of Waterloo</dim:field>
   <dim:field mdschema="dc" element="relation" qualifier="uri">https://github.com/amsen20/imem</dim:field>
   <dim:field mdschema="dc" element="relation" qualifier="uri">https://github.com/amsen20/scinear</dim:field>
   <dim:field mdschema="dc" element="subject">Scala</dim:field>
   <dim:field mdschema="dc" element="subject">Programming Languages</dim:field>
   <dim:field mdschema="dc" element="subject">Static Memory Management</dim:field>
   <dim:field mdschema="dc" element="subject">Alias Control</dim:field>
   <dim:field mdschema="dc" element="subject">Ownership and borrowing</dim:field>
   <dim:field mdschema="dc" element="subject">Linear and affine types</dim:field>
   <dim:field mdschema="dc" element="subject">Compiler</dim:field>
   <dim:field mdschema="dc" element="title">Linear Scala is All You Need for Safe Static Memory and Alias Management</dim:field>
   <dim:field mdschema="dc" element="type">Master Thesis</dim:field>
   <dim:field mdschema="dc" element="pending">false</dim:field>
   <dim:field mdschema="uws-etd" element="degree" qualifier="department">David R. Cheriton School of Computer Science</dim:field>
   <dim:field mdschema="uws-etd" element="degree" qualifier="discipline">Computer Science</dim:field>
   <dim:field mdschema="uws-etd" element="degree" qualifier="grantor" lang="en">University of Waterloo</dim:field>
   <dim:field mdschema="uws-etd" element="degree">Master of Mathematics</dim:field>
   <dim:field mdschema="uws-etd" element="embargo" qualifier="terms">0</dim:field>
   <dim:field mdschema="uws" element="contributor" qualifier="advisor">Lhoták, Ondřej</dim:field>
   <dim:field mdschema="uws" element="contributor" qualifier="affiliation1">Faculty of Mathematics</dim:field>
   <dim:field mdschema="uws" element="published" qualifier="city" lang="en">Waterloo</dim:field>
   <dim:field mdschema="uws" element="published" qualifier="country" lang="en">Canada</dim:field>
   <dim:field mdschema="uws" element="published" qualifier="province" lang="en">Ontario</dim:field>
   <dim:field mdschema="uws" element="typeOfResource" lang="en">Text</dim:field>
   <dim:field mdschema="uws" element="peerReviewStatus" lang="en">Unreviewed</dim:field>
   <dim:field mdschema="uws" element="scholarLevel" lang="en">Graduate</dim:field>
   <dim:field mdschema="others" element="access-status">open.access</dim:field>
</dim:dim>
</metadata></record></GetRecord></OAI-PMH>