package Foo;
use Moose;
use MooseX::Literals;

our $VERSION   = '0.01';
our $AUTHORITY = 'cpan:STEVAN';

has 'bar' => (
    is      => 'ro',
    default => sub {
        return [
            Baz->new(
               bar => sub { 
                   object {
                       has 'bar' => (is => 'rw', default => 10);
                       has 'baz' => (is => 'rw', default => sub { [] }); 
                       method 'foo' => sub { 'FOO' };
                       around 'bar' => sub {
                           my $next = shift;
                           $next->(@_) * 2;
                       };   
                   };            
                }
            )
        ];
    },
);

has 'baz' => (
    is      => 'ro',
    lazy    => 1,
    default => sub {
        my $self = shift;
        object {
            extends $self->bar->[0]->bar->()->meta->name;
        } (bar => 100, baz => {})            
    },
);

no Moose; 1;
