Subject: | [FEATUREREQ] Role generation method on the variant package |
Mostly, this kinda irks me:
> use Some::Long::Package;
> with Package(@args);
Because you have to be smart about it, especially with Moo Roles, as you must declare 'use' **BEFORE** 'use Moo::Role'
> package Bar
> use Moo::Role;
> use Some::Package # exports Package() as a method of Bar !
> with Package(@args);
So you have to order it thusly:
> package Bar
> use Some::Package # exports Package() as a method of Bar !
> use Moo::Role;
> with Package(@args);
Or face the risk of a collision when the same role is aggregated into the same, despite the variant design not being an inherent problem due to exporting different method names.
=~ Please add a feature in this sort of vein:
> package Bar;
> use Moo::Role;
> require Some::Package; # fuck imports ! :D
> with Some::Package->build_variant( @args );
Or it could even be standardised into a thing, like
> package Bar;
> use Moo::Role;
> require Some::Package; # fuck imports ! :D
> with Some::Package->COMPOSE_ROLE( @args );
And then even Moose could support it with their `with` syntax
> package Bar;
> use Moose::Role;
> with Some::Package => { @args };
....
Somewhere in Moose
> if ( $element[$i]->can('COMPOSE_ROLE') and ref $element->[$i+1] ){
> blahblahblah( $element[$i]->COMPOSE_ROLE($element[$i+1]) )
> }