On Mon, Jun 16, 2014 at 11:41 AM, John Macdonald <john.macdon...@oicr.on.ca> wrote:
> without the coerce, it does not do the conversion and only allows input > that has the explicit leading 'chr', but with the coerce parameter it gives > a compile time error complaining that the type needs to have a coercion. > By design, coercions are not inherited. (Not making a value assessment here, just confirming your (inadvertent) research :)) Am I going to have to write the duplicate coercion code for every one of > the 'real' sub-types that want to also have this optional prefix behaviour, > or is there an alternate way to write this? > tl;dr: yes :) Alternatively, it's possible to do a little type metaclass fiddling to find the parent type's coercions and pull those into the child's set. This is what we do in MooseX::AttributeShortcuts, for instance, when using the one-off subtyping behaviour. ~Chris -- Chris Weyl Ex astris scientia