Visitors: Fundamentals of protocol design