Skip Menu |

This queue is for tickets about the Function-Parameters CPAN distribution.

Report information
The Basics
Id: 85851
Status: resolved
Priority: 0/
Queue: Function-Parameters

People
Owner: MAUKE [...] cpan.org
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 1.0101
  • 1.0102
Fixed in: 1.0103



Subject: Type expressions are unnecessarily passed to Moose::Util::TypeConstraints::find_or_create_isa_type_constraint
If the type expression returns a blessed object, the result is still passed to find_or_create_isa_type_constraint. Not only is this redundant; it prevents people from using type expressions with non-Moose type libraries (e.g. Type::Tiny or MouseX::Types). A patch is attached that skips calling reify_type when the type expression returns something that is already a blessed object.
Subject: reify-type-patch.diff
--- Parameters.xs-orig 2013-06-04 14:31:17.601883207 +0100 +++ Parameters.xs 2013-06-04 14:31:58.246084748 +0100 @@ -798,7 +798,9 @@ sentinel_disarm(expr_sentinel); } *ptype = my_eval(aTHX_ sen, floor, expr); - *ptype = reify_type(aTHX_ sen, declarator, *ptype); + if (!sv_isobject(*ptype)) { + *ptype = reify_type(aTHX_ sen, declarator, *ptype); + } if (!sv_isobject(*ptype)) { croak("In %"SVf": (%"SVf") doesn't look like a type object", SVfARG(declarator), SVfARG(*ptype)); }
Thanks. FYI, here's the advice I'm providing re using Function::Parameters and Type::Tiny together: https://metacpan.org/module/TOBYINK/Type-Tiny-0.007_04/lib/Type/Tiny/Manual/Params.pod#Function::Parameters