Kent Fredric <kentfred...@gmail.com>
writes:

> On 27 March 2015 at 11:23, Diab Jerius <djer...@cfa.harvard.edu> wrote:
>
>> I've translated some code using multiple inheritance to Moo, and am
>> seeing some unexpected  behavior, namely that attributes inherited
>> from the second parent class are not properly initialized.
[…]
> Given the code works as expected when you s/Moo/Moose/, both in value
> initialization, and in explicitly passing arguments to the second-inherited
> module at construction time, I would agree that you have in fact found a
> bug in Moo.
>
> ( Unless of course Moo has some documentation about explicitly not
> supporting multiple inheritance )

It doesn't. In fact, https://metacpan.org/pod/Moo#extends says «Multiple
superclasses can be passed for multiple inheritance but please consider
using L<roles|Moo::Role> instead», and there's no mention of the
limitation in https://metacpan.org/pod/Moo#INCOMPATIBILITIES-WITH-MOOSE.

However, fixing it breaks a few tests that assert that it _doesn't_
work:

#   Failed test 'can't extend attribute from second parent'
#   at t/has-plus.t line 73.
#                   undef
#     doesn't match '(?^:no d attribute already exists)'
[…]
#   Failed test 'constructor doesn't populate right parent attribute'
#   at t/moo-c3.t line 34.
#          got: '3'
#     expected: undef

The tests were changed to expect the current buggy behaviour in this
commit:

commit f7813a5f2834a9dc03c7abdc2a9c4be940caa4e0
Author: Graham Knop <ha...@haarg.org>
Date:   2014-04-15 00:43:12 -0400

    fix multiple inheritance tests for expected behavior


-- 
"I use RMS as a guide in the same way that a boat captain would use
 a lighthouse.  It's good to know where it is, but you generally
 don't want to find yourself in the same spot." - Tollef Fog Heen

Reply via email to