HaloO,
Jonathan Lang wrote:
my @array = (0,1,2); # Array of Int
@array[3] = "three"; # Array of Int(&)Str
Actually, these would be something along the lines of "Array of Int"
and "Array of (Int, Int, Int, Str)", respectively. That is, each of
@array[0..2] would be of type "Int", while @array[3] would be of type
"Str".
Oh, no. Array of (Int,Int,Int,Str) would prescribe every single
entry to be of the type (Int,Int,Int,Str) and I believe you need
to write Seq[Int,Int,Int,Str].
@array itself would be of type "Array" (which, without any
further qualifiers, is equivalent to "Array of Any"). If you must
force a more restrictive type on @array, go with "Array of (Int |
Str)" (yes, I do mean "|", not "(|)"; it's a type-matching issue, not
a container-construction issue.)
Which is another argument for choosing '(|)' to mean supertype in
role combination.
Regards, TSa.
--