Syntactic Confectionery Delight | |
PerlMonks |
Re^3: OO-Perl Question: How Do I get a List of derived Classes for a Base Class?by BrowserUk (Patriarch) |
on Mar 14, 2010 at 03:57 UTC ( [id://828520]=note: print w/replies, xml ) | Need Help?? |
Choosing this type of implementation, it will be easy to extend the solution by a new commenttype: Only a new derived class is needed. You choose a derived class to instantiate, according to a comment in the data. That's fair enough, but it doesn't explain why you need to build a list of all possible derivable types? There is presumably a relationship between the value of the comment, and the name of the derived class to instantiate? All that knowing what is available achieves, is the ability to take a slightly earlier exit if you read a comment that requires a class that isn't available. But the additional complexity required to decide not to try and instantiate an instance of an unavailable class doesn't justify itself when simply making the attempt to instantiate the instance tells you the same information for free. Eg.
Versus:
I guess my question is, does the extra complexity of providing introspection buy you something that is otherwise unavailable; or provide for it in some way that is sufficiently better to justify the cost? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|