Formalizing dynamic-wind in the lambda calculus

Ryotaro Kasuga, S. Nishizaki
{"title":"Formalizing dynamic-wind in the lambda calculus","authors":"Ryotaro Kasuga, S. Nishizaki","doi":"10.1145/3524304.3524318","DOIUrl":null,"url":null,"abstract":"The Scheme programming language has the control constructs: call-with-current-continuation (call/cc) and dynamic-wind. The construct call/cc is a procedure to handle first-class continuations. The construct dynamic-wind is a procedure to hook a continuation captured by call/cc. It can add pre- and post-processing to a continuation, and allows flexible handling of global escape and control effect by continuation calls. The first example where the continuation is applied is rewriting variables with dynamic scope, and the second is saving and restoring registers during context switching of threads implemented in user space. On the other hand, dynamic-wind is very difficult to understand in Scheme. In fact, the semantics of dynamic-wind represent one of the most complicated mechanisms in Scheme. The semantics presented in the revised Scheme language definition remain complicated, and it is difficult to understand the behavior and write programs correctly. In this article, we focus on three main uses of dynamic-wind: resource allocation at continuous invocation time, and resource release at global escape time. The use of dynamic-wind is focused on resource management, and formalize resource state and resource operations in this paper. For the dynamic-wind modeled in such a way, we propose a type system and an effect system to track the resource state. In most of the discussions in this paper, we have simplified the model of dynamic-wind to clarify the theory. However, we will show that the method can be applied to more complex situations in practice.","PeriodicalId":420523,"journal":{"name":"Proceedings of the 2022 11th International Conference on Software and Computer Applications","volume":"11 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-02-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2022 11th International Conference on Software and Computer Applications","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3524304.3524318","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

The Scheme programming language has the control constructs: call-with-current-continuation (call/cc) and dynamic-wind. The construct call/cc is a procedure to handle first-class continuations. The construct dynamic-wind is a procedure to hook a continuation captured by call/cc. It can add pre- and post-processing to a continuation, and allows flexible handling of global escape and control effect by continuation calls. The first example where the continuation is applied is rewriting variables with dynamic scope, and the second is saving and restoring registers during context switching of threads implemented in user space. On the other hand, dynamic-wind is very difficult to understand in Scheme. In fact, the semantics of dynamic-wind represent one of the most complicated mechanisms in Scheme. The semantics presented in the revised Scheme language definition remain complicated, and it is difficult to understand the behavior and write programs correctly. In this article, we focus on three main uses of dynamic-wind: resource allocation at continuous invocation time, and resource release at global escape time. The use of dynamic-wind is focused on resource management, and formalize resource state and resource operations in this paper. For the dynamic-wind modeled in such a way, we propose a type system and an effect system to track the resource state. In most of the discussions in this paper, we have simplified the model of dynamic-wind to clarify the theory. However, we will show that the method can be applied to more complex situations in practice.
在lambda演算中形式化动态风
Scheme编程语言具有控制结构:call-with-current-continuation (call/cc)和dynamic-wind。构造call/cc是处理一级延续的过程。构造dynamic-wind是一个钩子由call/cc捕获的continuation的过程。它可以为continuation添加预处理和后处理,并允许通过continuation调用灵活地处理全局转义和控制效果。应用延续的第一个示例是重写具有动态作用域的变量,第二个示例是在用户空间中实现的线程的上下文切换期间保存和恢复寄存器。另一方面,动态风在Scheme中是很难理解的。实际上,动态风的语义是Scheme中最复杂的机制之一。修改后的Scheme语言定义中的语义仍然很复杂,很难理解其行为并正确编写程序。在本文中,我们将重点讨论动态风的三种主要用途:连续调用时的资源分配和全局逃逸时的资源释放。本文将动态风的应用重点放在资源管理上,将资源状态和资源操作形式化。对于这样的动态风模型,我们提出了类型系统和效果系统来跟踪资源状态。在本文的大部分讨论中,我们简化了动力风的模型,以阐明理论。然而,我们将证明该方法可以应用于实践中更复杂的情况。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
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学术文献互助群
群 号:604180095
Book学术官方微信
小红书