On 02/05/2010 11:29 PM, Jonathan Worthington wrote:
And the odering in dispatch is not a type lattice as in Cecil but a
topological ordering. Again I've no clue what that means.

and all objects that do A are also B doers. So one could infer that we
have A <: B. But note that this subtype relation is not enforced in the
body of the role or in the class it is composed into.
Can you clarify what you mean by "not enforced"?

I interpreted Thomas remark as the fact tha declaring subclass does not enforce safe substiatability.

Am I wrong?



Parametric roles are covariant on their type parameter irrespective of
its use. E.g. you can declare a read/write attribute of that type.
While parametric roles do fill the niche of parametric types, you can
also parametrize them with values - STD (the standard grammar) takes
advantage of this. In many ways, a parametric role definition works like
a kind of role factory; an implementation falls quite naturally out of
multiple dispatch and closure semantics. Seeing parametric roles as
being solely for parametric polymorphism is casting their role in Perl 6
a little too narrowly though.


I think nobody wanted to do it. The point is that if you add variance annontation (as in C# or Scala) to specify where you can use the type parameters coavariantly or contravariantly give you the same flexibility and furthermore type safety. The PL researcher I know at Javasoft still regret to have allowed covariance for Arrays (this is just second in the regret list, the first being that production people did not allow them to change the JVM to deal with generics in the bytecode).


I agree that the information that is available on the Perl 6 type system
is scattered across the synopses, and in some places probably needs a
look at the spectests, and probably has untested edge-cases too. Maybe
it'd be good to try and collect it together more at some point, so
there's a single source to point people at.


This is exactly my problem. I decided to post here after spending a couple of days just trying to understand what the precise syntax of types is in Perl6.


Hope this helps,


Yes. Actually the best source of information on types I found is your FAQ, that I was reading when I received your mail. Centralizing the information there would be much useful ... at least for me.


Thank you for both.
Beppe

Reply via email to