【24h】

From Dynamic Binding to State via Modal Possibility

机译:通过模态可能性从动态绑定到状态

获取原文
获取原文并翻译 | 示例

摘要

In this paper we propose a typed, purely functional calculus for state (with second-class locations) in which types reflect the dichotomy between reading from and writing into the global store. This is in contrast to the usual formulation of state via monads, where the primitives for reading and writing introduce the same monadic type constructor. We hope to argue that making this distinction is useful, simple, and has strong logical foundations. Our type system is based on the proof-term calculus for constructive modal logic S4, which has two modal type operators: □ for necessity and ◇ for possibility. We extend this calculus with the notion of names (which stand for locations) and generalize to indexed families of modal operators (indexed by sets of names). Then, the modal type □_cA classifies computations of type A which read from store locations listed in the set C. The dual type ◇_cA classifies computations which first write into the locations from C and than use the changed store to obtain a value of type A. There are several benefits to this development. First, the necessita-tion fragment of the language is interesting in its own: it formulates a calculus of dynamic binding. Second, the possibility operator ◇ is a monad, thus forcing the single-threading of memory writes, but not of memory reads (as these are associated with □). Finally, the different status of reads and writes gives rise to a natural way of expressing the allocation of uninitialized memory while also providing guarantees that only initialized locations are dereferenced.
机译:在本文中,我们为状态(具有第二类位置)提出了一种类型化的,纯功能的演算,其中类型反映了从全局存储读取和写入全局存储之间的二分法。这与通常通过单子状态表示形式相反,在单子状态下,用于读写的原语引入了相同的单子类型构造函数。我们希望提出这样的区分是有用的,简单的,并且具有强大的逻辑基础。我们的类型系统基于构造性模态逻辑S4的证明项演算,它具有两个模态类型运算符:□表示必要性,◇表示可能性。我们用名称(代表位置)的概念扩展了这种演算,并泛化为模态运算符的索引族(按名称集索引)。然后,模态类型□_cA对从集合C中列出的存储位置读取的类型A的计算进行分类。对偶类型◇_cA对首先从C写入位置然后使用更改后的存储获取类型值的计算进行分类答:这种发展有几个好处。首先,该语言的必要性片段本身很有趣:它构成了动态绑定的演算。其次,可能性运算符◇是monad,因此强制执行内存写操作的单线程操作,而不是内存读操作的单线程操作(因为这些操作与□关联)。最后,读取和写入的不同状态产生了一种自然的方式来表示未初始化的内存分配,同时还提供了仅初始化位置被取消引用的保证。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号