in reply to Re^10: Data Structures
in thread Data Structures
Sorry, been meaning to respond for a while, but been busy. I do agree with you that if OO is not appropriate, then don't use OO. I have been a huge fan of functional programming for a while, and honestly if I could use OCaml/LISP/Scheme/etc for $work, I would, but there is basically no decent libraries and lots of academic "abandonware". That said I am also not a big fan of YAGNI, and since at $work we typically maintain our apps as well as write them, I prefer to treat even small projects as if they might grow large (which they typically do, at least for us). But anyway, this is all a matter of style and environment. So let me just address the dependencies you listed.
Sub::UplevelThis is not my dependency, but a dependency for Test::Exception, which I consider a key part of any good testing toolbox. So that one is not going anywhere unless the Test::Exception author removes it. Moose does not ever use it itself.
Sub::ExporterWell to start with, Exporter is gotta be the biggest piece of bloatware in the perl core modules. I hate that module with a passion, just thinking about how bad it is makes my skin crawl. I never cared for Exporter::Lite either, it is better, but really the @EXPORTS and @EXPORTS_OK stuff is that makes me stay away, I don't like having to make public variables to export stuff.
Sub::Exporter on the other hand is awesome. Not only is just for exporting subs (who the hell exports variables anymore really), but it can do all sorts of fun tricks. You couldn't do this with Exporter:
Really, I think Nuff said there :P Sub::Namepackage LOL::Cat; use Moose 'has' => { -as => 'i_can_haz' }; i_can_haz 'cheeseburger' => ( is => 'rw', trigger => sub { print "NOM NOM" } ); LOL::Cat->new->cheeseburger('KTHNXBYE');;
Well first let me say that we have made this dependency entirely optional now as part of the whole "make XS optional" thing that the Best Practical people asked for.
What does return subname 'Moose::Role::extends' => sub {... }; buy you that *Moose::Role::extends = sub{ ... };To start with the CV will still have the name "__ANON__" and will not seem to come from the "Moose::Role" package (unless you did that code within the Moose::Role package itself). I think that it is important to maintain this internal consistency when building classes. But anyway, it's optional now so you can skip it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: Data Structures
by BrowserUk (Patriarch) on May 23, 2008 at 06:28 UTC | |
by stvn (Monsignor) on May 23, 2008 at 21:42 UTC | |
by BrowserUk (Patriarch) on May 23, 2008 at 23:07 UTC | |
by stvn (Monsignor) on May 24, 2008 at 04:28 UTC | |
by BrowserUk (Patriarch) on May 24, 2008 at 06:15 UTC |