On Mon, May 31, 2010 at 12:16:48PM -0700, Kate Yoak wrote:
> > On 20/05/2010, at 1:45 PM, Kate Yoak wrote:
> > 
> >> This problem actually screams for a MooseX::ImportGlobs kind of a module.  
> >> It feels like one ought to be able to dig around, find all the unnamed 
> >> globs and import them into meta with a single line of code.
> > 
> > 
> > How would you avoid importing globs from all the other packages who have 
> > exported functions into your module's namespace? e.g. List::Util functions
> > 
> > 
> 
> Why is it a bad thing to have all methods that exist in any form inside your 
> class imported into meta? They are methods now in the class's namespace, so 
> they ought to be introspectable, no?

Because the most common case for imports is not for importing methods.
If I say "use List::Util 'sum'" in my class, it's incredibly unlikely
that I actually mean for people to be able to say MyClass->sum(...).
namespace::clean and namespace::autoclean actually solve this problem
correctly, but we try to do what we can inside Moose itself to make
things do the right thing. The only exceptions here are overloads, which
aren't given proper subnames by overload.pm, and modules like the one
you're working with, which actually do want to import methods into your
class. Those kinds of modules are quite rare, though.

-doy

Reply via email to