From: John Napiorkowski Date: Fri, 25 Jun 2010 13:33:08 +0000 (-0400) Subject: removed some bad examples X-Git-Tag: 0.03~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8241430af17eaa1a0d59b9b761f2622d45720a6;p=gitmo%2FMooseX-Dependent.git removed some bad examples --- diff --git a/lib/MooseX/Types/Parameterizable.pm b/lib/MooseX/Types/Parameterizable.pm index 78a75a4..6956980 100644 --- a/lib/MooseX/Types/Parameterizable.pm +++ b/lib/MooseX/Types/Parameterizable.pm @@ -202,32 +202,19 @@ range: Notice how re-parameterizing the parameterizable type 'RangedInt' works slightly differently from re-parameterizing 'PositiveRange' Although it initially takes two type constraint values to declare a parameterizable type, should you wish to -later re-parameterize it, you only use a subtype of the second type parameter -(the parameterizable type constraint) since the first type constraint sets the parent -type for the parameterizable type. In other words, given the example above, a type -constraint of 'RangedInt' would have a parent of 'Int', not 'Parameterizable' and for -all intends and uses you could stick it wherever you'd need an Int. - - subtype NameAge, - as Tuple[Str, Int]; - - ## re-parameterized subtypes of NameAge containing a Parameterizable Int - subtype NameBetween18and35Age, - as NameAge[ - Str, - PositiveRangedInt[min=>18,max=>35], - ]; - -One caveat is that you can't stick an unparameterized parameterizable type inside a -structure, such as L since that would require the -ability to convert a 'containing' type constraint into a parameterizable type, which -is a capacity we current don't have. +later re-parameterize it, you only use a subtype of the extra type parameter +(the parameterizable type constraints) since the first type constraint sets the +parent type for the parameterizable type. + +In other words, given the example above, a type constraint of 'RangedInt' would +have a parent of 'Int', not 'Parameterizable' and for all intends and uses you +could stick it wherever you'd need an Int. =head2 Coercions Parameterizable types have some limited support for coercions. Several things must be kept in mind. The first is that the coercion targets the type constraint -which is being made parameterizable, Not the parameterizable type. So for example if you +which is being made parameterizable, Not the parameterized type. So for example if you create a Parameterizable type like: subtype RequiredAgeInYears,