On Fri, Nov 29, 2019 at 10:18:57AM +0000, Toby Inkster (TOBYINK) wrote: > This is a reply to Dave Mitchell's email, but it will probably get > threaded badly as I've only just subscribed to perl5-porters and don't > have the original email to click "reply" on. > > > This is all pretty over-engineered. It can be simplified to something > that would work well with existing type implementations such as > MooseX::Types, MouseX::Types, Type::Tiny, and Specio. If you haven't see them, Toby's blog postings on Type::Tiny are worth reading: http://blogs.perl.org/mt/mt-search.fcgi?blog_id=1019&tag=Type-Tiny&limit=20 > Second, define these: > > use Scalar::Util; > sub UNIVERSAL::check { > my ($class, $object) = @_; > blessed($object) && !blessed($class) && $object->DOES($class); > } > sub UNIVERSAL::get_message { > my ($class, $value) = @_; > "$value is not $class"; > } > > Third, nothing. There is no third. I think is should be distinct from isa, so I don't think the above is needed. Tony