Re: Announcement: Moose 2.0800 is released!

[email protected] (Ovid)
Newsgroups perl.moose
Message-ID <[email protected]>
Ouch! You're right. My apologies for the confusion. The examples should be this:

    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;

Versus:

    use 5.01000;
    { package a; use Moose::Role; with qw(b c); sub result { 'a' } }
    { package b; use Moose::Role; }
    { package c; use Moose::Role; sub result { 'c' } }
    { package d; use Moose::Role; with qw(a); }                                                                                     
    {
        package Consumer; use Moose;
        with 'd';
    }
    say Consumer->new->result;

Only the order of role consumption is changed, but the behavior is now different.

Cheers,
Ovid
--
Twitter - http://twitter.com/OvidPerl/
Buy my book - http://bit.ly/beginning_perl
Buy my other book - http://www.oreilly.com/catalog/perlhks/
Live and work overseas - http://www.overseas-exile.com/


>________________________________
> From: Jesse Luehrs <[email protected]>
>To: Ovid <[email protected]> 
>Cc: Karen Etheridge <[email protected]>; "[email protected]" <[email protected]> 
>Sent: Thursday, 28 March 2013, 17:11
>Subject: Re: Announcement: Moose 2.0800 is released!
> 
>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.