Hans, sorry I duped you on this message.
----- Original Message ---- > From: Hans Dieter Pearcey <h...@pobox.com> > To: moose <moose@perl.org> > Sent: Thursday, September 3, 2009 8:52:02 PM > Subject: subtyping parameterized types > > subtype Foo, as ArrayRef[Str], where { @$_ < 5 }; > > Foo is now a parameteriz*able* type, not a parameteriz*ed* type; that is, > in theory (if the MooseX::Types decorators allow it), you can: > > has foo_classes => (isa => Foo[ClassName]); > > since ClassName is a subtype of Str. > > This surprised me, and means that Native::Trait::Array/Hash totally don't work > with subtypes of parameterized types. We had a discussion about this a while back when I was adding parameterization support to MooseX::Types. I think this was a least of evils, let's punt until we really understand what we want. I duplicated the behavior for MooseX::Types::Structured, btw, you can reparamterize a structured type as long as you don't contradict the existing type. I took a similar approach to the stuff in the repo under MooseX::Dependent. As I said, this was the best idea we could come up with without any real use cases. Seems we have one now :) > > I'm poking at this now. Any insight is welcome. > > hdp.