|
ABSTRACT
Type-directed programming is an important idiom for software design. In type-directed programming the behavior of programs is guided by the type structure of data. It makes it possible to implement many sorts of operations, such as serialization,traversals, and queries,only once and without needing to continually revise their implementations as new data types are defined.Type-directed programming is the basis for recent research into "scrapping" tedious boilerplate code that arises in functional programming with algebraic data types. This research has primarily focused on writing type-directed functions that are closed to extension. However, Lämmel and Peyton Jones recently developed a technique for writing openly extensible type-directed functions in Haskell by making clever use of type classes. Unfortunately, this technique has a number of limitations such as the inability to write specialized cases for existential or nested data types and function types becoming too constrained to be used as first-class functions.We present an alternate approach to writing openly extensible type-directed functions by using the aspect-oriented programming features provided by the language AspectML. Our solution not only avoids the limitations present in Lämmel and Peyton Jones's technique, but also allows type-directed functions to be extended at any time with cases for types that were not even known at compiletime. This capability is critical to writing programs that make use of dynamic loading or runtime type generativity.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
 |
1
|
|
| |
2
|
P. Achten and R. Hinze. Combining generics and dynamics. Technical Report NIII-R0206, Nijmegen Institute for Computing and Information, July 2002.
|
| |
3
|
|
 |
4
|
|
| |
5
|
D.S. Dantas, D. Walker, G. Washburn, and S. Weirich. AspectML: A polymorphic aspect-oriented functional programmming language (extended version). ACM Trans. Programming Languages and Systems. To appear pending revisions.Draft available at http://www.cis.upenn.edu/~geoffw/research/papers/aspect-toplas.pdf
|
| |
6
|
|
| |
7
|
R. Hinze and A. Löh. "Scrap your boilerplate" revolutions. In Proceedings of 8th Int. Conf. on Mathematics of Program Construction (MPC), 2006.
|
| |
8
|
R. Hinze, A. Löh, and B.C. Oliveira. "Scrap your boilerplate" reloaded. In Proceedings of the 8th Int. Symp. on Functional and Logic Programming (FLOPS), pages 13--29, Fuji Susono,Japan,Apr.2006.
|
| |
9
|
|
| |
10
|
|
| |
11
|
Gregor Kiczales , Erik Hilsdale , Jim Hugunin , Mik Kersten , Jeffrey Palm , William G. Griswold, An Overview of AspectJ, Proceedings of the 15th European Conference on Object-Oriented Programming, p.327-353, June 18-22, 2001
|
 |
12
|
|
 |
13
|
Ralf Lämmel , Simon Peyton Jones, Scrap more boilerplate: reflection, zips, and generalised casts, Proceedings of the ninth ACM SIGPLAN international conference on Functional programming, September 19-21, 2004, Snow Bird, UT, USA
|
 |
14
|
|
| |
15
|
K. Läufer and M. Odersky. An extension of ML with first-class abstract types. In Proceedings of the SIGPLAN Workshop on ML and its Applications, pages 78--91,June 1992.
|
| |
16
|
X. Leroy, D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. The Objective Caml System:Documentation and user's manual,2000. Available from http://caml.inria.fr
|
 |
17
|
|
 |
18
|
|
 |
19
|
|
| |
20
|
|
 |
21
|
|
 |
22
|
|
| |
23
|
S. Peyton Jones.Haskell 98 Language and Libraries:The Revised Report. Cambridge University Press,2003.
|
| |
24
|
|
 |
25
|
Simon Peyton Jones , Dimitrios Vytiniotis , Stephanie Weirich , Geoffrey Washburn, Simple unification-based type inference for GADTs, Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming, September 16-21, 2006, Portland, Oregon, USA
|
| |
26
|
G.D. Plotkin.A note on inductive generalization. In Machine Intelligence ,volume 5,pages 153--163.Edinburgh University Press, 1970.
|
| |
27
|
J.C. Reynolds. Types, abstraction, and parametric polymorphism. Information processing ,pages 513--523,1983.
|
 |
28
|
|
 |
29
|
|
 |
30
|
|
 |
31
|
Dimitrios Vytiniotis , Geoffrey Washburn , Stephanie Weirich, An open and shut typecase, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.13-24, January 10-10, 2005, Long Beach, California, USA
[doi> 10.1145/1040294.1040296]
|
 |
32
|
|
| |
33
|
M. Wang,K.Chen,and S.-C.Khoo. On the pursuit of staticness and coherence. In Proceedings of the 5th Workshop on Foundations of Aspect-Oriented Languages (FOAL), Mar. 2006.
|
| |
34
|
|
| |
35
|
|
 |
36
|
|
| |
37
|
|
| |
38
|
S. Weirich and L. Huang. A design for type-directed Java. In V. Bono, editor,Workshop on Object-Oriented Developments (WOOD), ENTCS, Aug. 2004. 20 pages.
|
|