Guys,

Not sure this is possible with the currying syntax, but imagine
something similar to the following:

use MooseX::Declare;

class Property
{
    method get_model () { return Model->new; }
}

class Model
{
    method foo (Property :$property) {}
}

class PropertyModel
{
    has 'property' => ( isa => 'Property', is => 'ro', required => 1 );
    has 'model' => ( isa => 'Model', is => 'ro', lazy => 1, builder =>
'_set_model',
                               handles => { foo => [ foo => property
=> $self->property ] } );

    method _set_model () { return $property->get_model }
}

Now, even assuming that I've dealt with the circular dependency issues
(I have, through judicious application of Class::MOP::load_class), and
furthermore assuming that Property::get_model in actuality does
something more impressive that might make it actually make _sense_ :-D
... this still doesn't work, because I can't refer to $self in a 'has'
clause.  Is there a way I can make this work?  Although my example has
only one method I'm trying to curry, the real code would have several,
so I'd rather not have to make a bunch of wrapper methods (though
obviously that's my fallback plan).

So is there any way to have one attribute be the argument curried to
another attribute's methods?


            -- Buddy

Reply via email to