On Nov 27, 2009, at 5:45 PM, BUCHMULLER Norbert wrote:
Hi,

Hello.

am I totally wrong that I'd like to use 'handles' like this?

Hmm, no not really, this is kinda nice.

has foo => (
   isa => 'Foo',
   is => 'rw',
   handles => [
       'bar',
       'baz',
       qr/^qu+x$/,
   ],
);

I think that it's much more readable than creating a complex regex (even
with the 'x' flag) if there are lots of literal method names.

I have to agree with this sentiment myself as my regexpr-fu is fairly weak. However the other part of me is unsure if we need a new feature (which brings it's own complexities) when a solution can be accomplished using an existing feature in a somewhat complex way. I am strongly of the opinion that having many features with partially overlapping capabilities is more confusing then having less features that are more powerful (and therefor possible complex) but have less overlap.

Assuming that my point is valid, a first cut at implementing it is here:
http://github.com/mendel/moose

(DISCLAIMER: I have not reviewed the patch yet, so perhaps some of this is addressed, but I would like to see them openly discussed anyway).

- Would you expect this work with Native traits? If so how would you expect it to work?

- What is the order of evaluation? Is that even relevant? What might be some issues that would bring up?

- Would you support having multiple regexprs in the list? Again how would order of evaluation be handled? What if it matches for one regexpr and not for another? Is this a conflict? or do we accept both?

- How do you handle methods which match the strings and also match the regexpr? Is the method list made unique before applying? Same for multiple regexprs?

I would like to make sure these items are thought through before we consider putting this feature in the core. I will also point out that it is the policy (in Moose::Manual::Contributing) that something like this be first tested out in a MooseX:: module.

- Stevan

Reply via email to