Sciweavers

ENTCS
2006

A Type-theoretic Reconstruction of the Visitor Pattern

13 years 3 months ago
A Type-theoretic Reconstruction of the Visitor Pattern
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. Key words: Visitor pattern, polymorphic types, object-oriented programming, Generic Java
Peter Buchlovsky, Hayo Thielecke
Added 12 Dec 2010
Updated 12 Dec 2010
Type Journal
Year 2006
Where ENTCS
Authors Peter Buchlovsky, Hayo Thielecke
Comments (0)