瑞士的强制

Stefan Monnier
{"title":"瑞士的强制","authors":"Stefan Monnier","doi":"10.1145/1292597.1292604","DOIUrl":null,"url":null,"abstract":"Recent type systems allow the programmer to use types that describe more precisely the invariants on which the program relies. But in order to satisfy the type system, it often becomes necessary to help the type checker with extra annotations that justify why a piece of code is indeed well-formed. Such annotations take the form of term-level type manipulations, such as type abstractions, type applications, existential package packing and opening, as well as coercions, or casts. While those operations have no direct runtime cost, they tend to introduce extra runtime operations equivalent to n-redexes or even empty loops in order to get to the point where we can apply that supposedly free operation. We show a coercion that is like a pacific Swiss army knife of coercions: it cannot cut but it can instantiate, open, pack, abstract, analyze, or do any combination thereof, reducing the need for extra surrounding runtime operations. And all that, of course, for the price of a single coercion, which still costs absolutely nothing at runtime. This new coercion is derived from Karl Crary's coercion calculus [Crary, 2000], but can also replace Crary and Weirich's vcase [Crary and Weirich, 1999]. It additionally happens to come in handy to work around some limitations of value polymorphism. It is presented in the context of Shao et al.'s Type System for Certified Binaries [Shao et al., 2002]. Other than the coercion itself, another interesting aspect of this work is a slightly unusual proof technique to show soundness of the type erasure using a pure type assignment language, making the no-op nature of our cast more obvious.","PeriodicalId":153056,"journal":{"name":"Programming Languages meets Program Verification","volume":"88 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2007-10-02","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":"{\"title\":\"The swiss coercion\",\"authors\":\"Stefan Monnier\",\"doi\":\"10.1145/1292597.1292604\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Recent type systems allow the programmer to use types that describe more precisely the invariants on which the program relies. But in order to satisfy the type system, it often becomes necessary to help the type checker with extra annotations that justify why a piece of code is indeed well-formed. Such annotations take the form of term-level type manipulations, such as type abstractions, type applications, existential package packing and opening, as well as coercions, or casts. While those operations have no direct runtime cost, they tend to introduce extra runtime operations equivalent to n-redexes or even empty loops in order to get to the point where we can apply that supposedly free operation. We show a coercion that is like a pacific Swiss army knife of coercions: it cannot cut but it can instantiate, open, pack, abstract, analyze, or do any combination thereof, reducing the need for extra surrounding runtime operations. And all that, of course, for the price of a single coercion, which still costs absolutely nothing at runtime. This new coercion is derived from Karl Crary's coercion calculus [Crary, 2000], but can also replace Crary and Weirich's vcase [Crary and Weirich, 1999]. It additionally happens to come in handy to work around some limitations of value polymorphism. It is presented in the context of Shao et al.'s Type System for Certified Binaries [Shao et al., 2002]. Other than the coercion itself, another interesting aspect of this work is a slightly unusual proof technique to show soundness of the type erasure using a pure type assignment language, making the no-op nature of our cast more obvious.\",\"PeriodicalId\":153056,\"journal\":{\"name\":\"Programming Languages meets Program Verification\",\"volume\":\"88 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2007-10-02\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"5\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Programming Languages meets Program Verification\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/1292597.1292604\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Programming Languages meets Program Verification","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1292597.1292604","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5

摘要

最近的类型系统允许程序员使用更精确地描述程序所依赖的不变量的类型。但是为了满足类型系统,通常有必要为类型检查器提供额外的注释,以证明为什么一段代码确实是格式良好的。这种注释采用术语级类型操作的形式,例如类型抽象、类型应用程序、存在包的打包和打开,以及强制转换。虽然这些操作没有直接的运行时成本,但它们往往会引入额外的运行时操作,相当于n-redex,甚至是空循环,以便我们能够应用所谓的免费操作。我们展示的强制就像太平洋瑞士军刀的强制:它不能切割,但它可以实例化、打开、打包、抽象、分析或进行任何组合,从而减少了对周围运行时操作的额外需求。当然,所有这一切都是以单个强制转换的代价为代价的,它在运行时仍然完全没有成本。这种新的强制推导来源于Karl Crary的强制演算[Crary, 2000],但也可以取代Crary和Weirich的vcase [Crary和Weirich, 1999]。它还可以用来解决值多态性的一些限制。它是在Shao等人的认证二进制文件类型系统的背景下提出的[Shao等人,2002]。除了强制转换本身之外,这项工作的另一个有趣的方面是使用纯类型赋值语言来显示类型擦除的可靠性的稍微不同寻常的证明技术,这使得我们的强制转换的无操作性质更加明显。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
The swiss coercion
Recent type systems allow the programmer to use types that describe more precisely the invariants on which the program relies. But in order to satisfy the type system, it often becomes necessary to help the type checker with extra annotations that justify why a piece of code is indeed well-formed. Such annotations take the form of term-level type manipulations, such as type abstractions, type applications, existential package packing and opening, as well as coercions, or casts. While those operations have no direct runtime cost, they tend to introduce extra runtime operations equivalent to n-redexes or even empty loops in order to get to the point where we can apply that supposedly free operation. We show a coercion that is like a pacific Swiss army knife of coercions: it cannot cut but it can instantiate, open, pack, abstract, analyze, or do any combination thereof, reducing the need for extra surrounding runtime operations. And all that, of course, for the price of a single coercion, which still costs absolutely nothing at runtime. This new coercion is derived from Karl Crary's coercion calculus [Crary, 2000], but can also replace Crary and Weirich's vcase [Crary and Weirich, 1999]. It additionally happens to come in handy to work around some limitations of value polymorphism. It is presented in the context of Shao et al.'s Type System for Certified Binaries [Shao et al., 2002]. Other than the coercion itself, another interesting aspect of this work is a slightly unusual proof technique to show soundness of the type erasure using a pure type assignment language, making the no-op nature of our cast more obvious.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信