foreach/opApply is the visitor pattern

BCS none at anon.com
Sat Jan 31 12:45:10 PST 2009


Hello Lars,

> 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.
> 

Well I guess I just figured out how to cut the time it takes to explain by 
about 90%. Nifty. Maybe the docs should use the term.




More information about the Digitalmars-d-learn mailing list