当前位置: X-MOL 学术arXiv.cs.PL › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Retentive Lenses
arXiv - CS - Programming Languages Pub Date : 2020-01-07 , DOI: arxiv-2001.02031
Zirun Zhu, Zhixuan Yang, Hsiang-Shang Ko, Zhenjiang Hu

Based on Foster et al.'s lenses, various bidirectional programming languages and systems have been developed for helping the user to write correct data synchronisers. The two well-behavedness laws of lenses, namely Correctness and Hippocraticness, are usually adopted as the guarantee of these systems. While lenses are designed to retain information in the source when the view is modified, well-behavedness says very little about the retaining of information: Hippocraticness only requires that the source be unchanged if the view is not modified, and nothing about information retention is guaranteed when the view is changed. To address the problem, we propose an extension of the original lenses, called retentive lenses, which satisfy a new Retentiveness law guaranteeing that if parts of the view are unchanged, then the corresponding parts of the source are retained as well. As a concrete example of retentive lenses, we present a domain-specific language for writing tree transformations; we prove that the pair of get and put functions generated from a program in our DSL forms a retentive lens. We demonstrate the practical use of retentive lenses and the DSL by presenting case studies on code refactoring, Pombrio and Krishnamurthi's resugaring, and XML synchronisation.

中文翻译:

保持镜头

基于 Foster 等人的镜头,已经开发了各种双向编程语言和系统来帮助用户编写正确的数据同步器。镜片的两个良性规律,即正确性和希波克拉底性,通常被用作这些系统的保证。虽然镜头被设计为在修改视图时保留源中的信息,但行为良好对信息的保留几乎没有说明:希波克拉底只要求如果视图未修改则源保持不变,并不能保证信息保留当视图改变时。为了解决这个问题,我们建议对原始镜头进行扩展,称为保持镜头,它满足新的保持定律,保证如果视图的某些部分不变,然后源的相应部分也被保留。作为保持镜头的一个具体例子,我们提出了一种用于编写树转换的特定领域语言;我们证明了从我们的 DSL 中的程序生成的一对 get 和 put 函数形成了一个保持镜头。我们通过展示关于代码重构、Pombrio 和 Krishnamurthi 的糖化以及 XML 同步的案例研究来展示保持镜头和 DSL 的实际使用。
更新日期:2020-01-10
down
wechat
bug