On Mar 10, 2010, at 12:48 PM, Nick Perez wrote:
On Wed, 10 Mar 2010 12:19:12 -0500
Sir Robert Burbridge <[email protected]> wrote:
What's bad about them? What makes them "annoying and ugly?"
The biggest problem with Attributes in general is that they are just
dumb strings. All that you see in Cat ":PathPart('blah')" has to be
parsed and ascribed meaning. PathPart isn't special. It isn't really
some function call. And once you strip away the veneer and realize
what
an ugly hack it is built on top of parsed strings given meaning, you
want to avoid them for representing complex pieces of information.
Additionally they usually need to be captured very early in the
compile-time cycle, way before they can actually be useful. The result
is that you end up having to a lot of your own bookkeeping code to
manage them. This is why you have to do this:
package My::Catalyst::Controller;
use Moose;
BEGIN { extends 'Catalyst::Controller' }
Because Catalyst::Controller must capture the attributes in your file
at compile time, and if 'extends' is not called at BEGIN time then it
is too late to capture the attributes.
Also the API that Perl provides for them is quite possibly one of the
most awkward APIs I have ever had the displeasure to work with.
In short, they look nice, they seem nice, but actually using them is a
messy nightmare best avoided.
- Stevan