Law and Order for Typestate with Borrowing

Hannes Saffrich, Yuki Nishida, Peter Thiemann
{"title":"Law and Order for Typestate with Borrowing","authors":"Hannes Saffrich, Yuki Nishida, Peter Thiemann","doi":"arxiv-2408.14031","DOIUrl":null,"url":null,"abstract":"Typestate systems are notoriously complex as they require sophisticated\nmachinery for tracking aliasing. We propose a new, transition-oriented\nfoundation for typestate in the setting of impure functional programming. Our\napproach relies on ordered types for simple alias tracking and its\nformalization draws on work on bunched implications. Yet, we support a flexible\nnotion of borrowing in the presence of typestate. Our core calculus comes with a notion of resource types indexed by an ordered\npartial monoid that models abstract state transitions. We prove syntactic type\nsoundness with respect to a resource-instrumented semantics. We give an\nalgorithmic version of our type system and prove its soundness. Algorithmic\ntyping facilitates a simple surface language that does not expose tedious\ndetails of ordered types. We implemented a typechecker for the surface language\nalong with an interpreter for the core language.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":"5 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.14031","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Typestate systems are notoriously complex as they require sophisticated machinery for tracking aliasing. We propose a new, transition-oriented foundation for typestate in the setting of impure functional programming. Our approach relies on ordered types for simple alias tracking and its formalization draws on work on bunched implications. Yet, we support a flexible notion of borrowing in the presence of typestate. Our core calculus comes with a notion of resource types indexed by an ordered partial monoid that models abstract state transitions. We prove syntactic type soundness with respect to a resource-instrumented semantics. We give an algorithmic version of our type system and prove its soundness. Algorithmic typing facilitates a simple surface language that does not expose tedious details of ordered types. We implemented a typechecker for the surface language along with an interpreter for the core language.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
借贷类型国家的法律和秩序
类型状态系统是出了名的复杂,因为它们需要复杂的机器来跟踪别名。我们为不纯函数式编程环境中的类型状态提出了一种新的、面向过渡的基础。我们的方法依赖于有序类型来实现简单的别名跟踪,其形式化借鉴了有关成串含义的工作。然而,我们支持在存在类型状态的情况下灵活借用。我们的核心微积分包含一个资源类型概念,该概念由一个有序部分单元索引,该单元对抽象状态转换进行建模。我们证明了资源工具语义的语法类型健全性。我们给出了类型系统的算法版本,并证明了其合理性。算法类型化为简单的表面语言提供了便利,它不会暴露有序类型的繁琐细节。我们为表面语言实现了一个类型检查器,同时还为核心语言实现了一个解释器。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Memory Consistency and Program Transformations No Saved Kaleidosope: an 100% Jitted Neural Network Coding Language with Pythonic Syntax Towards Quantum Multiparty Session Types The Incredible Shrinking Context... in a decompiler near you Scheme Pearl: Quantum Continuations
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1