+In this talk, I propose a new take on borrowing based on a type and effect system and Boolean algebraic subtyping. Instead of restricting the aliasing of sensitive resources, we track their uses as side effects in the type system. Then, we encode borrowing by describing regions in which certain effects cannot occur – which is represented through the use of Boolean negation types. Moreover, using a slight generalization of MLstruct’s Boolean-algebraic subtype inference allows us to express programs that make use of borrowing without any type annotations in user programs. Finally, since our borrowing discipline is entirely type-based (and not syntactic, unlike Rust’s borrow-checker), we can freely modularize the code by, for instance, moving arbitrary parts of an implementation into helper functions, enabling fearless refactoring.
0 commit comments