NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Why Do You Hate Polymorphism? (Score:1)
How ironic that you try to enable subclassing but you forbid polymorphism with that ghastly method-as-function silliness.
Re:Why Do You Hate Polymorphism? (Score:1)
Polymorphism is already forbidden unless I want to rewrite a significant section of the existing code. I am therefore trying to find a way to get the behavior I want without doing that rewrite or else cutting and pasting.
The first two solutions that I tried (neither of which worked) tried to extend the existing code in such a way that they would not affect anyone else who wanted to extend the existing code using the same technique. In other words I was trying to make my approach as polymorphic as possible given the existing code.
Only after those approaches both failed did I consider injecting my code directly into that module. Given the structure of my application I am extremely confident that I only need one stash. And this behavior is what I want for my stash. So the non-polymorphism is not actually a problem.
However I tried to make it polymorphic. Really.
Reply to This
Parent
Re: (Score:1)
I'm sure that's the same rationale why the original code is difficult to subclass; the author figured that one one would ever want to subclass it, so non-subclassibility is not actually a problem.
Re: (Score:1)
The module in question is used by a large number of people for many different things, and therefore the author should assume far less about how it is likely to be used in the future.
I also note that, even though I don't think polymorphism is important within my code base, I looked first for a solution
Re: (Score:1)
That solution is easy and it's shorter than what you have.
Re: (Score:1)
That idiom appears within other code within Template::Stash::Context. Again, if you want to fix that, fixing it in my code is less important than changing it in the main module. Doubly so because it already can't be readily subclassed, which makes any worries about the best way to be polymorphic completely irrelevant.
That said, your fix has its own issues. Suppose that somewhere up the calling stack someone is using signals and a die handler. If that signal ha
Re: (Score:1)
Glancing at the title of your journal entry here, one might reasonably assume that you care about things like Liskov substitution. Best of luck to you playing the odds in reliable software development.
(After all, it's not as if signal handling in Perl is at all reliable, whereas noth