On 02/05/2010 10:53 PM, TSa (Thomas Sandlaß) wrote:
HaloO Mr Castagna
I'm delighted to have you interested in Perl 6. I know your book and
articles and have argued for a type system of Perl 6 here on the list
for quite a while.
Wow, so actually somebody read it! :-) Thank you
Unfortunately I'm not able to implement one for
Parrot or so. But if you are willing to port the CDuce code this is
a great thing!
Well, I really have not time nor human power to do it, but the specification is
pretty simple for anyone with a functional language background. I can provide
more information if needed. As a matter of fact I am going to define it in the
work that is at the origin of my first post, so stay tuned.
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.
Yes I saw that inheritance is not subtyping. I would not share this decision
since as an outsider, it seems to me that Perl6 has redundant syntax (too many
different ways to express the same thing), so it is astonishing that in that
case the choice was to use the same keywork for two different things. But it is
likely that I missed the point there.
The spec says nothing
about class inheritance and type narrowness. Parametric roles are covariant
on their type parameter irrespective of its use.
Yeah I also noticed that reading the Parametric subtyping section in Chapter 14
of the Synopsis. This is quite unfortunate since the right way to deal with all
these issues has been well known for at least ten years (e.g. Bounded and
F-bounded polymorphism and variance annotations), even though it is just
recently that they appeared in maistream languages (e.g. variance annotations in
C# 4.0).
Actually I noticed an old post you did on this list 5 years ago. It contained
the following drawing
A|B lub (lowest upper bound)
/ \
/ \
A 0 B
/ \ / \
/ \ / \
/ A&B \ glb (greatest lower bound)
/ 1 / \ 2 \
/ / 3 \ \
and it is the only reference I found to intersection types (since A&B is the
intersection of A and B (if you consider a class type as the set of all its
instances) that is it contains all objects that are instance both of A and of B.
Is this notation (or the general idea of intersection types) has been abandoned
since then (I was not able to find it in the synopsis)
Cheers
Beppe