jwz@lucid.com (Jamie Zawinski) (11/17/90)
In article <3904@s3.ireq.hydro.qc.ca> gamin@ireq-robot.hydro.qc.ca (Martin Boyer) wrote:
Consider the classic
(send square :draw-yourself)
and let's say we want to add some functionality by allowing an extra
argument to indicate where this square should be drawn:
(send square :draw-yourself :on-screen)
(send square :draw-yourself :on-printer)
In Flavors, one would have to re-write the draw-yourself method to
discriminate on the second argument, because the procedure depends on
it. But wait! isn't that what "send" was supposed to do in the first
place, discriminate on the first argument to find out which method to
use? We now need 'draw-yourself' methods specialized on more than one
argument, the object and the medium (as if, in this case, the medium
IS the message :-)).
BZZZZZT! Thank you for playing.
(defmethod (square :draw-yourself :case :on-screen) () ... )
(defmethod (square :draw-yourself :case :on-printer) () ... )
-- Jamie "you can supplant old-Flavors when you pry it from my
cold dead fingers" Zawinski