[Perl5-syntax] Method::Signatures, now with types

Buddy Burden barefootcoder at gmail.com
Wed Apr 20 23:17:07 GMT 2011


Nick,

On Mon, Mar 21, 2011 at 1:42 PM, Nick Perez <nick at nickandperla.net> wrote:
> :
> :
> I'll see about possibly adding in the ability to choose at import in
> MXD the ability to use this over MXMS. Shouldn't take too much since
> the underlying mechanism is the same.

Resurrecting this old thread to get your expert opinion.

So I've managed to get Method::Signatures inserted into MXD.  Using
your excellent (and helpful) suggestions, it works basically like
this:

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

    class Foo { method uses_ms_not_mxms () {} }

or, alternatively:

    use MooseX::Declare;

    class My::Declare extends MooseX::Declare { use
Method::Signatures::Modifiers; }

    # later ...

    use My::Declare;

    class Foo { method uses_ms_not_mxms () {} }

Both work great, functionally (although I'll reiterate Schwern's
caveat from last time we brought this up: this doesn't duplicate _all_
of MSMX's functionality, just most of it).  But I've noticed that,
with this method, MXMS is still going to be _loaded_.  It's never
used, I don't believe, but I think it's still using up some memory
unnecessarily.  I believe this is due to
MooseX::Declare::Syntax::MethodDeclaration, which has several use
statements that will drag in MXMS and/or bits thereof.

Can you think of a good way to avoid this? or do you think I'm
worrying unnecessarily and it's no big deal?


            -- Buddy



More information about the Perl5-syntax mailing list