[racket] Visitor Pattern and Racket

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Jan 20 18:25:57 EST 2013

On Jan 19, 2013, at 9:43 PM, Harry Spier wrote:

> Does the Visitor pattern give something that collecting the methods in
> the main class or using a mixin doesn't?  Or do the class features of
> Racket, particularly mixins make the Visitor Pattern superfluous?


Yes. 

Normal OOPLs suffer from a lack of expressiveness. 
OO programmers make up for this lack with programming
patterns. If you don't have first-class functions, 
simulate them with the command pattern. If you don't 
have functions but you want to emphasize functional 
style, use the visitor pattern. 

The extensible visitor pattern is the only contribution
in the book that is of some interest to Racket programmers. 
But we have units and mixins, and we can do this thing
even better. 

Once we have types for these, the question becomes whether
the type system will be strong enough to get away without
the one ugly cast. 

-- Matthias


Posted on the users mailing list.