So, the customary
solution in singly dispatched object oriented languages to this problem is to
employ an idiom known as “double dispatch(ing)”.

Multiple dispatch
was first described in a classic OOPSLA ’86 paper by Smalltalk master-coder
Dan Ingalls. Kurt Hebel and Ralph Johnson produced a nice, readable treatment
of Double Dispatch about 12 years ago.

The code above
illustrate how it works.

When an Irishman
imbibes a Dram, he can’t be sure exactly what’s in it, but he knows for sure
its been drunk by an Irishman.

He dutifully informs
the Libation of this fact.

By virtue of
thissecond method invocation, true
polymorphism is brought into play a second time.

And, sure and
begora, the Irishman may not have been sure what he drank, but a Dram of
IrishWhisky knows just what to do when its inside an Irishman.

Of course, using
double dispatch requires that you implement these ricochet / pinball bumper
routines. In general, the number which must be implemented is potentially,
but seldom actually, quite large. We’ll see just how large later in this
presentation.