Type systems usually characterize the shape of values but not their free variables. However, there are many desirable safety properties one could guarantee if one could track how references can escape. For example, one may implement algebraic effect handlers using capabilities -- a value which permits one to perform the effect -- safely if one can guarantee that the capability itself does not escape the scope bound by the effect handler. To this end, we study the $\textrm{CF}_{<:}$ calculus, a conservative and lightweight extension of $\textrm{System F}_{<:}$, to track how values and their references can be captured and escape. We show that existing terms in $\textrm{System F}_{<:}$ embed naturally in our calculus, and that many natural problems can be expressed in a system that tracks variable references like we do in $\textrm{CF}_{<:}$. We also give mechanized proofs of the soundness properties of $\textrm{CF}_{<:}$ in Coq. The type system presented in $\textrm{CF}_{<:}$ is powerful enough to reason about safety in the context of many natural extensions of $\textrm{CF}_{<:}$ such as region-based memory-management, non-local returns, and effect handlers.
翻译:类型系统通常具有价值形状的特性, 但不是自由变量的特性。 但是, 如果能够追踪引用如何可以逃脱, 有许多可取的安全属性。 例如, 我们可以使用能力来应用代数效应处理器 -- -- 这个值允许一个人发挥作用 -- -- 安全地, 如果能保证能力本身不会逃脱效果处理器约束的范围。 为此, 我们研究 $\ textrm{ CF{}}}: $ 微积分, $\ textrm{ System:} $ 的保守和轻量级扩展。 我们也可以在 Coq 中找到如何捕捉和逃避这些引用。 我们用 $\ textrm{ System F} 显示现有术语, 这个值可以自然嵌入我们的计算器中。 许多自然问题可以在一个系统中表达, 这个系统可以追踪像 $\ textrm{ CF} { { {} :} $: we algened 证明$\ text crial- relistal real relifal redistrutal refal refal: press as: ex relifal real real real as: exfact real real refact refal as: ex: $ * * * * * * * * * * * * * * * * * * * * * 足够 足够的不足够) 等的自然- 等以 等的自然安全性安全性机域域域域域域域域的不具有足够强烈性机能 。