Artigo Acesso aberto

A Type-theoretic Reconstruction of the Visitor Pattern

2006; Elsevier BV; Volume: 155; Linguagem: Inglês

10.1016/j.entcs.2005.11.061

ISSN

1571-0661

Autores

Peter Buchlovsky, Hayo Thielecke,

Tópico(s)

Advanced Database Systems and Queries

Resumo

In object-oriented languages, the Visitor pattern can be used to traverse tree-like data structures: a visitor object contains some operations, and the data structure objects allow themselves to be traversed by accepting visitors. In the polymorphic lambda calculus (System F), tree-like data structures can be encoded as polymorphic higher-order functions. In this paper, we reconstruct the Visitor pattern from the polymorphic encoding by way of generics in Java. We sketch how the quantified types in the polymorphic encoding can guide reasoning about visitors in general.

Referência(s)