On May 8, 2010, at 1:27 PM, Eric Veith1 wrote:
Stevan Little <[email protected]> wrote on 05/08/2010
07:09:47
PM:
I have a serious allergy to method attributes, I don't ever use them
so I couldn't comment.
Do you mind giving me some bullet points regarding your allergy? I
found
method attributes rather appealing until now, but if there's some
serious
trouble ahead, I can still change my design (and would).
Sure, here are my basic bullets:
- The attributes.pm API is horrible and requires all sorts of odd
things in order to be properly supported inheritance.
The MX::MethodAttributes hides much of this, but that's not all ...
- attributes are nothing more then strings, you must parse them
yourself.
In the simple case this is not that hard, but simple cases have a
habit of growing into complex cases over time. This kind of thing just
adds to the fragility of attributes overall.
- attributes must be on a single line
C'mon, really??? This seems simple, but it is a silly restriction that
can easily trip newcomers up. Again, just added to the fragility in my
opinion.
- attributes don't actually do *anything*
Well, they do associate string metadata with a function/method, the
rest you must do yourself.
---
Personally I lean towards exporting keyword-like functions. I explored
method attributes for the before/after/around modifiers in the early
early days of Moose and abandoned them shortly afterwards for all the
reasons listed above.
Honestly, the way it sounds like you are using them (to "mark"
methods) is likely fine, just keep in mind that it might not scale if
your needs grow too complex.
- Stevan