John M. Dlugosz wrote:
I do see that the use in a role is like a generic.
But you would use the sigil every time, e.g.
method doit (::?CLASS $self: ::?CLASS $other --> ::?CLASS)
that is not three separate generics with conflicting names, but the same
thing. With generics you can only use the sigil on the first use.
You are right and I didn't address this, sorry. Actually the
only solution I see is dropping the ::? twigil altogether and
specify that CLASS is lexically declared by the compiler.
Otherwise we have to make a special case exception out of
That is all methods in a role are parametric on ::?CLASS just
as all methods in a class are parametric on ::?SELF
class B is A;
instanciates a new type &doit:(B $self: $a, $b, $c). This nicely
But doit is not a type. I think you were talking something like that
earlier and I didn't follow.
It is an arrow type, like foo: Int --> Int and bar: Int --> Int.
These are structurally identical. The fun thing is that the Perl 6
type system is supposed to be nominal. Thus foo and bar are different
types. But contradictory to that you can use foo and bar wherever
an Int --> Int is expected. I love this self contradiction of Perl ;)
Well, and you can't neither use foo nor bar to denote the arrow type.
Note that I consider myself a knowledgeable bystander with the
knowledgeable being debatable ;)
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare