HaloO chromatic,
you wrote:
> That was always my goal for roles in the first place. I'll be a little sad if
> Perl 6 requires an explicit notation to behave correctly here -- that is, if
> the default check is for subtyping, not polymorphic equivalence.
What is "polymorphic equivalence" to you? I remember us discussion the
issue of duck typing versus nominal typing. I'll try to dig that out.
But here is a version from memory using John's pointlike role:
%h<x y new midpoint> = T.new(1), T.new(2), &new, &midpoint;
where &new and &midpoint refer to code objects with applicable
signature. Then I think that we have
%h.does(Point) === False;
%h.like(Point) === True;
with the second test being more elaborate and hence more expensive.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan
Thread Previous
|
Thread Next