Title
Rust-like borrowing with 2nd-class values (short paper).
Abstract
The Rust programming language demonstrates that memory safety can be achieved in a practical systems language, based on a sophisticated type system that controls object lifetimes and aliasing through notions of ownership and borrowing. While Scala has traditionally targeted only managed language runtimes, the ScalaNative effort makes Scala a viable low-level language as well. Thus, memory safety becomes an important concern, and the question bears asking what, if anything, Scala can learn from Rust. In addition, Rust's type system can encode forms of protocols, state machines, and session types, which would also be useful for Scala in general. A key challenge is that Rust's typing rules are inherently flow-sensitive, but Scala's type system is not. In this paper, we sketch one possible method of achieving static guarantees similar to Rust with only mild extensions to Scala's type system. Our solution is based on two components: First, the observation that continuation passing style (CPS) or monadic style can transform a flow-sensitive checking problem into a type-checking problem based on scopes. Second, on a previously presented type system extension with second-class values, which we use to model scope-based lifetimes.
Year
DOI
Venue
2017
10.1145/3136000.3136010
SPLASH '17: Conference on Systems, Programming, Languages, and Applications: Software for Humanity Vancouver BC Canada October, 2017
Keywords
Field
DocType
Rust,Scala,programming model,safety,memory model,borrowing,second-class
Memory safety,Scala,Programming language,Programming paradigm,Computer science,Finite-state machine,Theoretical computer science,Rust (programming language),Memory model,Continuation-passing style,Monad (functional programming)
Conference
ISBN
Citations 
PageRank 
978-1-4503-5529-2
0
0.34
References 
Authors
10
2
Name
Order
Citations
PageRank
Leo Osvald1404.55
Tiark Rompf274345.86