Journal article
Refactoring Pattern Matching
- Abstract:
- Defining functions by pattern matching over the arguments is advantageous for understanding and reasoning, but it tends to expose the implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to program refactoring based on a right-invertible language RINV - every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation, while maintaining simple and sound reasoning.
Actions
Access Document
- Files:
-
-
(Preview, pdf, 186.1KB, Terms of use)
-
- Publisher copy:
- 10.1016/j.scico.2012.07.014
Authors
- Journal:
- Science of Computer Programming More from this journal
- Volume:
- 78
- Issue:
- 11
- Pages:
- 2216-2242
- Publication date:
- 2012-01-01
- DOI:
- UUID:
-
uuid:d1fb0b79-3744-48b0-97e9-05df6e500a29
- Local pid:
-
cs:4064
- Deposit date:
-
2015-03-12
- ARK identifier:
Terms of use
- Copyright date:
- 2012
If you are the owner of this record, you can report an update to it here: Report update to this record