Retentive Lenses

01/07/2020
by   Zirun Zhu, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/09/2017

Synthesizing Bijective Lenses

Bidirectional transformations between different data representations occ...
research
07/24/2023

The potential of LLMs for coding with low-resource and domain-specific programming languages

This paper presents a study on the feasibility of using large language m...
research
10/23/2019

Towards a Complete Picture of Lens Laws

Bidirectional transformation, also called lens, has played important rol...
research
02/22/2019

Automating the Diagram Method to Prove Correctness of Program Transformations

We report on the automation of a technique to prove the correctness of p...
research
04/27/2023

Traced Types for Safe Strategic Rewriting

Strategy languages enable programmers to compose rewrite rules into stra...
research
09/26/2022

A metalanguage for cost-aware denotational semantics

We present two metalanguages for developing synthetic cost-aware denotat...

Please sign up or login with your details

Forgot password? Click here to reset