I wrote an article trying explain/propose (static) typing for Perl 6. In
particular I explain how to type subs, multi subs, classes, multi
methods; how to use union, intersection and subset types; and I finally
use these notions to explain the old problem of covariance vs.
contravariance in object-oriented programming.
The target reader of (the first part of) the article is every Perl 6
programmer, which is why all the above is explained by examples of Perl
6 code (no formula, theory, theorem, or property whatsoever) and I tried
to do my best to make the article completely self-contained. This is
also why comments from this mailing list are *very* welcome.
The second part of the paper targets language implementers and
designers: if the first part convinced you of the usefulness of such
(possibly optional) types, then you will find in the second part the
details of data structures and algorithms to efficiently implement this
type system. I also give extensive references in which you will find
how to extend the system by some missing bits (notably, polymorphism).
The paper can be retrieved at the following url.
http://www.pps.univ-paris-diderot.fr/~gc/papers/perl6-typing.pdf
I insist, comments from Perl 6 programmers will be extremely welcome:
just do not be (too) harsh, please :-)
Thank you in advance for your help
Giuseppe Castagna