Jon Lang dataweaver-at-gmail.com |Perl 6| wrote:
Ah; that clears things up considerably. If I understand you
correctly, John is using '£' to mean "use Duck Typing here". _That_,
I can definitely see uses for. As well, spelling it as 'like' instead
of '£' is _much_ more readable. With this in mind, the above
signature reads as "$p1 must be like a Point, but it needn't actually
be a Point. Both $p2 and the return value must be the same type of
thing that $p1 is."
What, if anything, is the significance of the fact that pointlike (in
John's example; 'Point' in TSa's counterexample) is generic?
It is designed for coping with generics and virtual types that have been
redefined by the base class. It works for structural "duck" typing too,
using the same algorithm.
The example shows that it needs to figure out what T must be, and help
show how generic classes don't have the proper "isa" because the types
change in each specialization.