Section 3.2's example does not fail for the given reason "This tries to
access the c instance variable of the argument $b thus yielding a run-time
error" - instead Perl6 more correctly complains that it was expecting a
ColPoint, but got a Point instead. Indeed one cannot generally replace a
subtype with its parent type, only the other way around. Can correct by
re-writing along the lines of "This fails to dispatch because ColPoint's
equal method requires a ColPoint argument, but we are calling it with the
supertype Point, which does not compose with the method's signature."

(Furthermore if "equal" is defined as a "multi method," then the dispatcher
chooses Point's "equal" method, and the example returns "True," which all
looks good to me. But it doesn't illustrate the paper's point.)


Reply via email to