foreach/opApply is the visitor pattern

Lars Ivar Igesund larsivar at igesund.net
Sat Jan 31 05:20:50 PST 2009


BCS wrote:

> Correct me if I'm wrong but I thing that D's opApply is a form of the
> Visitor pattern where the calling function's stack frame is the visitor
> object.
> 
> This just occurred to me. Maybe I've been missing something re the visitor
> pattern but I think this make for a nice, cool and easy way to describe
> it. (Also I don't remember it being described that way)

Indeed, I heard it called that a long time ago, and have explained it as 
such since then.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d-learn mailing list