Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 44049
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: stevan.little [...] gmail.com
Requestors: toddr [...] cpanel.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Roles to support
I am using roles in Moose. I noticed an error message trying to require an attribute from another class saying requires does not support attributes. This would be a useful feature to support. Are there design issues that make this a dificult problem to solve?
Todd, Not really design issues so much as it is just not a simple task. We have long pondered a requires_attr of some kind but figuring out exactly how it would work is the tricky part. For instance, if you specify a type constraint in your requirement, something like: requires_attr 'foo' => (isa => 'ArrayRef'); should you have to supply *exactly* that type constraint? or would a subtype of that constraint do? The same goes for all the other options available during attribute construction, and gets even more complex when you try to figure out how to support some of the MooseX:: extensions in a meaningful way. I think at this point there are more important items to work on, such as a general refactor of the type system guts, startup time speed improvements and a cleaner inline method generation system. However, that does not mean that patches are not welcome. I think I would prefer to discuss details on the mailing list first so as to get all the edge cases and issues out in the open. Thanks, - Stevan On Wed Mar 11 18:40:45 2009, todd_rinaldo wrote: Show quoted text
> I am using roles in Moose. I noticed an error message trying to require > an attribute from another class saying requires does not support > attributes. > > This would be a useful feature to support. Are there design issues that > make this a dificult problem to solve?
Subject: Re: [rt.cpan.org #44049] Roles to support
Date: Wed, 11 Mar 2009 21:37:33 -0500 (CDT)
To: "Todd E. Rinaldo via RT" <bug-Moose [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 11 Mar 2009, Todd E. Rinaldo via RT wrote: Show quoted text
> I am using roles in Moose. I noticed an error message trying to require > an attribute from another class saying requires does not support > attributes.
However, you _can_ require an attribute-generated method, as long as you use the requiring role after you declare the attribute (and thus generate the method). -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
This is not a bug, but a major feature request and one that is already on the list. No need to keep this open. - Stevan