{"title":"借贷类型国家的法律和秩序","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":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"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\":null,\"pages\":null},\"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}","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}
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.