On Sun, Aug 14, 2005 at 08:28:33PM +0800, Autrijus Tang wrote: : S06 made many explicit uses of generics as classes, which I find : difficult to reconcile with the "only roles takes type parameter" : ruling. For example: : : my Hash of Array of Recipe %book; : my Hash[returns=>Array[returns=>Recipe]] %book; : : And later: : : class LoudArray is Array { ... } : : Clearly, here Hash and Array are used as instantiable, generic classes, : instead of mere roles. Does this need to change, or can we lift the : ban on type-parameterized classes?
I think the distinction is still useful to document that there are still unbound types. What we need to emphasize is that a role can be used as a class, at which point any unbound types are bound to Any, or whatever we're calling it these days. I'd say Array is a role, not a class. So these all might do different things: class LoudArray is Array { ... } role LoudArray does Array { ... } role LoudArray is Array { ... } Interestingly, what is bound by trait as a container type can still be a role rather than a class, since the actual class might not be instantiated till we know the shape, and that might not be known till the time of elaboration of the variable declaration: my num @array is shape($x,$y); That's assuming we treat shapes as a type signature... It doesn't have to be for integer indexes, maybe, but for hashes: my Fight %hash is shape(Dog,Cat); it looks susupiciously like a type signature. Maybe it should be written: my Fight %hash :(Dog,Cat); or even my %hash :(Dog,Cat --> Fight); Larry