develooper Front page | perl.perl6.language | Postings from July 2006

Another quick one: .as<ancestor>

Thread Next
Aaron Sherman
July 12, 2006 09:52
Another quick one: .as<ancestor>
Message ID:
I would assume that all classes automatically define:

 multi submethod *infix:<as> ($self: $?CLASS) { $self }

so that derived classes can automatically:


Without actually changing their implementation details (only the type
that Perl currently thinks it's dealing with polymorphically).

In fact, I would expect that this bit of behind-the-curtain magic is how
the MCP arranges for polymorphism when you:

 sub foo(Object $x) {...}
 my A $y;

Is all of that fair?

Aaron Sherman <>
Senior Systems Engineer and Toolsmith
"We had some good machines, but they don't work no more." -Shriekback

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About