skip to main content

Fusing Direct Manipulations into Functional Programs

Published:05 January 2024Publication History
Skip Abstract Section

Abstract

Bidirectional live programming systems (BLP) enable developers to modify a program by directly manipulating the program output, so that the updated program can produce the manipulated output. One state-of-the-art approach to BLP systems is operation-based, which captures the developer's intention of program modifications by taking how the developer manipulates the output into account. The program modifications are usually hard coded for each direct manipulation in these BLP systems, which are difficult to extend. Moreover, to reflect the manipulations to the source program, these BLP systems trace the modified output to appropriate code fragments and perform corresponding code transformations. Accordingly, they require direct manipulation users be aware of the source code and how it is changed, making "direct" manipulation (on output) be "indirect".

In this paper, we resolve this problem by presenting a novel operation-based framework for bidirectional live programming, which can automatically fuse direct manipulations into the source code, thus supporting code-insensitive direct manipulations. Firstly, we design a simple but expressive delta language DM capable of expressing common direct manipulations for output values. Secondly, we present a fusion algorithm that propagates direct manipulations into the source functional programs and applies them to the constants whenever possible; otherwise, the algorithm embeds manipulations into the "proper positions" of programs. We prove the correctness of the fusion algorithm that the updated program executes to get the manipulated output. To demonstrate the expressiveness of DM and the effectiveness of our fusion algorithm, we have implemented FuseDM, a prototype SVG editor that supports GUI-based operations for direct manipulation, and successfully designed 14 benchmark examples starting from blank code using FuseDM.

References

  1. F. Bancilhon and N. Spyratos. 1981. Update Semantics of Relational Views. ACM Trans. Database Syst., 6, 4 (1981), dec, 557–575. issn:0362-5915 https://doi.org/10.1145/319628.319634 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Wei-Ngan Chin. 1992. Safe Fusion of Functional Expressions. SIGPLAN Lisp Pointers, V, 1 (1992), jan, 11–20. issn:1045-3563 https://doi.org/10.1145/141478.141494 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ravi Chugh, Brian Hempel, Mitchell Spradlin, and Jacob Albers. 2016. Programmatic and direct manipulation, together at last. Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, Jun, https://doi.org/10.1145/2908080.2908103 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Evan Czaplicki. 2012. Elm: A delightful language for reliable webapps. https://elm-lang.org/ Accessed: 2023-07-04 Google ScholarGoogle Scholar
  5. Krzysztof Czarnecki, Nate Foster, Zhenjiang Hu, Ralf Lämmel, Andy Schürr, and James Terwilliger. 2009. Bidirectional Transformations: A Cross-Discipline Perspective. 5563, 260–283. isbn:978-3-642-02407-8 https://doi.org/10.1007/978-3-642-02408-5_19 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Zinovy Diskin, Yingfei Xiong, and Krzysztof Czarnecki. 2010. From State- to Delta-Based Bidirectional Model Transformations. In Proceedings of the Third International Conference on Theory and Practice of Model Transformations (ICMT’10). Springer-Verlag, Berlin, Heidelberg. 61–76. isbn:3642136877 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Zinovy Diskin, Yingfei Xiong, Krzysztof Czarnecki, Hartmut Ehrig, Frank Hermann, and Fernando Orejas. 2011. From State- to Delta-Based Bidirectional Model Transformations: The Symmetric Case. In Proceedings of the 14th International Conference on Model Driven Engineering Languages and Systems (MODELS’11). Springer-Verlag, Berlin, Heidelberg. 304–318. isbn:9783642244841 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. 2007. Combinators for Bidirectional Tree Transformations: A Linguistic Approach to the View-Update Problem. 29, 3 (2007), may, 17–es. issn:0164-0925 https://doi.org/10.1145/1232420.1232424 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Koumei Fukahori, Daisuke Sakamoto, Jun Kato, and Takeo Igarashi. 2014. CapStudio: An Interactive Screencast for Visual Application Development. Conference on Human Factors in Computing Systems - Proceedings, isbn:978-1-4503-2474-8 https://doi.org/10.1145/2559206.2581138 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Brian Hempel and Ravi Chugh. 2016. Semi-Automated SVG Programming via Direct Manipulation. In Proceedings of the 29th Annual Symposium on User Interface Software and Technology (UIST ’16). Association for Computing Machinery, New York, NY, USA. 379–390. isbn:9781450341899 https://doi.org/10.1145/2984511.2984575 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Brian Hempel, Justin Lubin, and Ravi Chugh. 2019. Sketch-n-Sketch: Output-Directed Programming for SVG. In Proceedings of the 32nd Annual ACM Symposium on User Interface Software and Technology (UIST ’19). Association for Computing Machinery, New York, NY, USA. 281–292. isbn:9781450368162 https://doi.org/10.1145/3332165.3347925 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Martin Hofmann, Benjamin Pierce, and Daniel Wagner. 2012. Edit Lenses. In Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’12). Association for Computing Machinery, New York, NY, USA. 495–508. isbn:9781450310833 https://doi.org/10.1145/2103656.2103715 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Mikaël Mayer, Viktor Kuncak, and Ravi Chugh. 2018. Bidirectional Evaluation with Direct Manipulation. Proc. ACM Program. Lang., 2, OOPSLA (2018), Article 127, oct, 28 pages. https://doi.org/10.1145/3276497 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Sergey Melnik, Atul Adya, and Philip A. Bernstein. 2008. Compiling Mappings to Bridge Applications and Databases. ACM Trans. Database Syst., 33, 4 (2008), Article 22, dec, 50 pages. issn:0362-5915 https://doi.org/10.1145/1412331.1412334 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Atsushi Ohori and Isao Sasano. 2007. Lightweight Fusion by Fixed Point Promotion. In Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’07). Association for Computing Machinery, New York, NY, USA. 143–154. isbn:1595935754 https://doi.org/10.1145/1190216.1190241 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Armando Solar-Lezama. 2008. Program synthesis by sketching. University of California, Berkeley. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Akihiko Takano and Erik Meijer. 1995. Shortcut Deforestation in Calculational Form. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA ’95). Association for Computing Machinery, New York, NY, USA. 306–313. isbn:0897917197 https://doi.org/10.1145/224164.224221 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Vlad Ureche, Aggelos Biboudis, Yannis Smaragdakis, and Martin Odersky. 2015. Automating Ad Hoc Data Representation Transformations. SIGPLAN Not., 50, 10 (2015), oct, 801–820. issn:0362-1340 https://doi.org/10.1145/2858965.2814271 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. H. von Koch. 1904. Sur une courbe continue sans tangente obtenue par une construction geometrique elementaire. Norstedt & soner. https://books.google.com.hk/books?id=kf3NnQAACAAJ Google ScholarGoogle Scholar
  20. Philip Wadler. 1988. Deforestation: Transforming Programs to Eliminate Trees. Theor. Comput. Sci., 73, 2 (1988), jan, 231–248. issn:0304-3975 https://doi.org/10.1016/0304-3975(90)90147-A Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Xing Zhang, Guanchen Guo, Xiao He, and Zhenjiang Hu. 2023. Bidirectional Object-Oriented Programming: Towards Programmatic and Direct Manipulation of Objects. Proc. ACM Program. Lang., 7, OOPSLA1 (2023), Article 83, apr, 26 pages. https://doi.org/10.1145/3586035 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Xing Zhang and Zhenjiang Hu. 2022. Towards Bidirectional Live Programming for Incomplete Programs. In Proceedings of the 44th International Conference on Software Engineering (ICSE ’22). Association for Computing Machinery, New York, NY, USA. 2154–2164. isbn:9781450392211 https://doi.org/10.1145/3510003.3510195 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Xing Zhang, Ruifeng Xie, Guanchen Guo, Xiao He, Tao Zan, and Zhenjiang Hu. 2023. FuseDM. https://doi.org/10.5281/zenodo.8419913 Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Fusing Direct Manipulations into Functional Programs

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Article Metrics

      • Downloads (Last 12 months)130
      • Downloads (Last 6 weeks)63

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader