Re: overlapping attributes not detected
[email protected] (Karen Etheridge) Sat, 4 Oct 2014 11:47:16 -0700
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <20141004184716.GL73734@tequila> |
On Fri, Oct 03, 2014 at 09:28:22PM +0000, John Macdonald wrote: > If you have a role and its consumer both specify the same attribute name (neither one using +name) there is no complaint from Moose and the second one encountered is used and the first is ignored. > I tracked this down after getting an error that the predicate method was not found - that was defined in the version of the attribute that was discarded without notice. > Could there be something done in the 'has' handler to detect such duplicates and give an error rather than this sort of quiet misaction? This is actually a feature. Roles and subclasses should be able to completely override an earlier attribute declaration. There are, of course, opportunities to make this more clear in documentation...