Results 1 - 10
of
20
Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming
- Proc. of the ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI 2003
, 2003
"... We describe a design pattern for writing programs that traverse data structures built from rich mutually-recursive data types. Such programs often have a great deal of "boilerplate" code that simply walks the structure, hiding a small amount of "real" code that constitutes the reason for the travers ..."
Abstract
-
Cited by 108 (10 self)
- Add to MetaCart
We describe a design pattern for writing programs that traverse data structures built from rich mutually-recursive data types. Such programs often have a great deal of "boilerplate" code that simply walks the structure, hiding a small amount of "real" code that constitutes the reason for the traversal. Our technique allows most...
A Generic Programming Extension for Clean
- The 13th International workshop on the Implementation of Functional Languages, IFL’01, Selected Papers, volume 2312 of LNCS
, 2002
"... Abstract. Generic programming enables the programmer to define functions by induction on the structure of types. Defined once, such a generic function can be used to generate a specialized function for any user defined data type. Several ways to support generic programming in functional languages ha ..."
Abstract
-
Cited by 51 (27 self)
- Add to MetaCart
Abstract. Generic programming enables the programmer to define functions by induction on the structure of types. Defined once, such a generic function can be used to generate a specialized function for any user defined data type. Several ways to support generic programming in functional languages have been proposed, each with its own pros and cons. In this paper we describe a combination of two existing approaches, which has the advantages of both of them. In our approach overloaded functions with class variables of an arbitrary kind can be defined generically. A single generic definition defines a kind-indexed family of overloaded functions, one for each kind. For instance, the generic mapping function generates an overloaded mapping function for each kind. Additionally, we propose a separate extension that allows to specify a customized instance of a generic function for a type in terms of the generated instance for that type. 1
Term Rewriting With Traversal Functions
- ACM Trans. Softw. Eng. Methodol
, 2001
"... Term rewriting is an appealing technique for performing program analysis and program transformation. Tree (term) traversal is frequently used but is not supported by standard term rewriting. ..."
Abstract
-
Cited by 51 (8 self)
- Add to MetaCart
Term rewriting is an appealing technique for performing program analysis and program transformation. Tree (term) traversal is frequently used but is not supported by standard term rewriting.
Visitor Combination and Traversal Control
- OOPSLA 2001 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications
, 2001
"... The Visitor design pattern allows the encapsulation of polymorphic behavior outside the class hierarchy on which it operates. A common application of Visitor is the encapsulation of tree traversals. Unfortunately, visitors resist composition and allow little traversal control. ..."
Abstract
-
Cited by 49 (9 self)
- Add to MetaCart
The Visitor design pattern allows the encapsulation of polymorphic behavior outside the class hierarchy on which it operates. A common application of Visitor is the encapsulation of tree traversals. Unfortunately, visitors resist composition and allow little traversal control.
Typed Combinators for Generic Traversal
- Proc. of PADL 2002
, 2002
"... Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, bu ..."
Abstract
-
Cited by 41 (16 self)
- Add to MetaCart
Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms.
Strategic Programming Meets Adaptive Programming
, 2003
"... Strategic programming is a generic programming idiom for processing compound data such as terms or object structures. At the heart of the approach is the separation of two concerns: basic dataprocessing computations vs. traversal schemes. Actual traversals are composed by passing the former as argum ..."
Abstract
-
Cited by 23 (7 self)
- Add to MetaCart
Strategic programming is a generic programming idiom for processing compound data such as terms or object structures. At the heart of the approach is the separation of two concerns: basic dataprocessing computations vs. traversal schemes. Actual traversals are composed by passing the former as arguments to the latter. Traversal schemes can be defined by the strategic programmer using a combinator style that relies on primitives for layered traversal. In this paper, we take a look at strategic programming from an aspect-oriented programming perspective. Throughout the paper, we compare strategic programming with adaptive programming, which is a well-established aspectual approach to the traversal of object structures. We start from the observation that aspect-oriented programming terms, e.g., crosscutting, join point, and advice can be instantiated for aspectual traversal approaches.
Typed Generic Traversal With Term Rewriting Strategies
- Journal of Logic and Algebraic Programming
, 2002
"... A typed model of strategic term rewriting is developed. The key innovation is that generic. The calculus traversal is covered. To this end, we define a typed rewriting calculus S ′ γ employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy t ..."
Abstract
-
Cited by 21 (7 self)
- Add to MetaCart
A typed model of strategic term rewriting is developed. The key innovation is that generic. The calculus traversal is covered. To this end, we define a typed rewriting calculus S ′ γ employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of type-preserving and type-unifying strategies. S ′ γ offers traversal combinators to construct traversals or schemes thereof from many-sorted and generic strategies. The traversal combinators model different forms of one-step traversal, that is, they process the immediate subterms of a given term without anticipating any scheme of recursion into terms. To inhabit generic types, we need to add a fundamental combinator to lift a many-sorted strategy s to a generic type γ. This step is called strategy extension. The semantics of the corresponding combinator states that s is only applied if the type of the term at hand fits, otherwise the extended strategy fails. This approach dictates that the semantics of strategy application must be type-dependent to a certain extent. Typed strategic term rewriting with coverage of generic term traversal is a simple but expressive model of generic programming. It has applications in program
Type-safe Functional Strategies
- In Draft proc. of SFP'00, St
, 2000
"... We demonstrate how the concept of strategies originating from term rewriting can be introduced in a typed, functional setting. We provide a model of strategies based on a further generalisation of updatable, monadic, generalised fold algebras. We show how strategies can be used as a structuring devi ..."
Abstract
-
Cited by 11 (5 self)
- Add to MetaCart
We demonstrate how the concept of strategies originating from term rewriting can be introduced in a typed, functional setting. We provide a model of strategies based on a further generalisation of updatable, monadic, generalised fold algebras. We show how strategies can be used as a structuring device for functional programming. 1

