Re: Announcement: Moose 2.0800 is released!

[email protected] (Jesse Luehrs)
Newsgroups perl.moose
Message-ID <[email protected]>
On Thu, Mar 28, 2013 at 08:59:51AM -0700, Ovid wrote:
> So the following code will print 'c' (previously it was a fatal error
> requiring the dev to state exactly what they intended):
> 
>     use 5.01000;
>     { package a; use Moose::Role; sub result { 'a' } }
>     { package b; use Moose::Role; }
>     { package c; use Moose::Role; with qw(a b); sub result { 'c' } }
>     { package d; use Moose::Role; with qw(c); }
>     {
>         package Consumer; use Moose;
>         with 'd';
>     }
>     say Consumer->new->result;
> 
> And this will print 'a', even though the class is consuming what
> appears to be the same role:
> 
>     use 5.01000;
>     { package a; use Moose::Role; sub result { 'a' } }
>     { package b; use Moose::Role; }
>     { package c; use Moose::Role; with qw(a b); sub result { 'c' } }
>     { package d; use Moose::Role; with qw(c); }
>     {
>         package Consumer; use Moose;
>         with 'd';
>     }
>     say Consumer->new->result;
> 
> Note that in the above examples, I have changed nothing but the order
> in which the roles are consumed, but my behavior has changed.

I can't tell what point you're trying to make here, because these two
code samples are identical.

-doy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.