mauke / Function-Parameters

Function::Parameters - define functions and methods with parameter lists ("subroutine signatures")
https://metacpan.org/pod/Function::Parameters
18 stars 19 forks source link

Configurable types #1

Closed tobyink closed 11 years ago

tobyink commented 11 years ago

This allows non-parenthesised type constraints to be looked up via a function other than Moose::Util::TypeConstraints::find_or_create_isa_type_constraint. There is no API exposed for it; you need to twiddle %^H in a BEGIN block. The reason being that this is intended for people subclassing or wrapping Function::Parameters; not for most end users. This would be really handy for the benefit of MooX::Aspartame.

mauke commented 11 years ago

Brain dump: I don't like that this API only accepts function names, not refs, and I don't like that it's global and orthogonal to scopes/keywords. That is, I believe a given keyword should always parse its type annotations with the same function.

Alternative branch pushed: https://github.com/mauke/Function-Parameters/tree/custom-type-reification - thoughts?

tobyink commented 11 years ago

Closing pull request because yours is better.

Re the keyword customization API, yes it's unwieldly, but personally I'm not bothered by it. After all, you can subclass Function::Parameters just fine; override import to insert your own defaults and then never need to bother with that API again.