On Tue, Jul 29, 2014 at 03:47:05PM -0400, Dave Rolsky via RT wrote:
Show quoted text> It occurred to me that we can ensure we have the right meta object by
> simply capturing the return value of init_meta() calls and passing
> that object around to where it's needed.
>
> This needs more investigation, but if I'm right we could simplify the
> internals a fair bit, and make MXRP less bug-prone at the same time.
init_meta is actually not required to return anything - the return value
has never been used in the past, and there are quite a few existing
modules that don't bother to return anything. Additionally, init_meta
was intended to eventually just go away, since all of its functionality
has been moved into import (unless you actually override it).
I don't think any of the modules that do return something return
anything other than the $metaclass parameter, though.
In any case, I don't think this is correct, because the point of
meta_lookup is that MXRP wants to be able to export both 'parameter' and
'method' keywords into the same package, but have them operate on
different metaclasses - 'parameter' is used outside of the role block,
and applies to the Parameterizable metaclass, and 'method' is used
inside the role block, and applies to the Parameterized metaclass. This
can't be handled just by special-casing things in the 'method' keyword
definition because it also re-exports everything in Moose::Role, so
those keywords also need a way to know that they should be acting on the
Parameterized metaclass and not the Parameterizable metaclass. I don't
know how you would encode this information other than by having
something where you could request "which metaclass should I be using
now?".
-doy