Re: Types for Perl 6: request for comments

[email protected] (yary)
Newsgroups perl.perl6.language
Message-ID <CAG2CFAbsFfL3F8G_z3hUouY=JMpWzk-0WWL7mdcGF4egbjraYw@mail.gmail.com>
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.)

-y
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.