The price has been that the set of classes must be fixed in advance, and they must each have a so-called accept method. In this paper we demonstrate how to program visitors without relying on accept methods and without knowing all classes of the objects in advance. It supports all visitors as subclasses, and they can be programmed without any further use of reflection. Thus a program using the Visitor pattern can now be understood as a specialized version of a program using the Walkabout class. Their full subcategory forms a 2-valued topos satisfying the axiom of choice.
Listable objects are isomorphic to finite cardinals.
The FISh language definition Author CBJ Abstract FISh is a array-based programming language that combines imperative and functional programming styles. This report gives a formal definition of the types, terms and evaluation rules of the language, plus some additional guidance on implementation issues. The covariant type system is rich enough to represent polymorphism on inductive types, such as lists and trees, and yet is simple enough to have a set-theoretic semantics. Its chief novelty is to replace function types by transformation types, which denote parametric functions. Their free type variables are all in positive positions, and so can be modelled by covariant functors.