grauzone wrote:
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)

More importantly, why does it matter?
Because there is a difference? opApply is more like a functor. Not the visitor pattern in my view of things.

They are/can be used to solve different things.

The visitor pattern commonly can be used to avoid case object.type: situations, to deal with different object types. Whereas a functor is used for other things, like iteration.

Reply via email to