Jonathan Lang wrote:
> OK. My main dog in this race is the idea of defining new roles
> through the concepts of the intersection or difference between
> existing roles (even the union was thrown in there mainly for the sake
> of completion), with the consequent extension of the type system in
> the opposite direction from the usual one (toward the more general);
I strongly agree. Having a language that allows supertying has novelty.
But I think that union is not there for completion but as integral part
when it comes to defining a type lattice which I still believe is the
most practical approach to typing. This includes computed types, that
is "artificial" nodes in the lattice. These intermediate types are
usually produced during type checking and automatic program reasoning.
Think e.g. of the type of an Array:
my @array = (0,1,2); # Array of Int
@array = "three"; # Array of Int(&)Str
This Int(&)Str type might actually be Item. The flattened |@array
has type Seq[Int,Int,Int,Str] but the unflattend array should say
something that is applicable to all its contents. The array might
actually maintain this content type at runtime.
> And yes, this "roles as sets" paradigm would presumably mean that you
> could examine roles using '⊂', '⊃', '∈', and so on.
BTW, are the ASCII equivalents spelled (<), (>) and (in)?