Peter,

> However, I would prefer an interface where the signature is specified in the 
> prototype slot of the sub:
>
>     sub foo (bar, baz) { ... }

Why don't you just use one of the signatures modules?  E.g.,

#! /usr/bin/perl

use MooseX::Declare;
use Method::Signatures::Modifiers;

class Foo
{
    method foo ($bar, $baz)
    {
        print $self->frobnabulate($bar, $baz);
    }
}

Foo->new->foo(1, 2, 3);

produces:

In call to Foo::foo(), was given too many arguments, it expects 2 at
t.pl line 13.

If you don't like the MooseX::Declare stuff, it should work equally
well with just Method::Signatures.  I'm pretty sure there's a place to
hook into MS or MSM somewhere post-compilation, but, if there isn't,
perhaps we could add it.

Maybe there's some reason this can't work that I'm not seeing, but it
seems to me like you're trying to solve a problem that's already been
solved pretty well, but in a roundabout way instead of using the known
solutions as a jumping off point.  Hopefully this can trigger a
lightbulb in your head, but, if not, feel free to ignore me. :-)


            -- Buddy

Reply via email to