As an addendum to the original question, consider that there are three or four different sub-sets of functionality that you would like to provide the Base module.
If these sub-sets are completely seperable then how do you implement them so that you can pull in one or two of the sub-sets witout hoisting symbols into the Base package and allowing other people to still sub-class Base.
N
Nigel Rantor wrote:
Hi all,
So, I want to extend an OO package.
The methods I want to add don't require access to any of the object's data and are just built upon the methods that the object already provides.
What would be the best way to hoist these methods into the original package's name space?
Alternatively would you simply not pollute someone elses namespace?
If you don't pollute their name space then do you have to release a class that has the extensions in it and make people instantiate that class? How do you deal with other people who want to extend the same base?
Phew. Hmm. Okay. Also, this isn't really a question about OO purism so if you want to rant about it please don't feel obliged to.
For an example, lets take the following minimal package as our base class.
----------------------------------------------------------------- package Base;
sub new { my $class = shift; my $self = {}; return bless $self, $class; }
# # draw_line( ax, ay, bx, by ) # sub draw_line { ... } -----------------------------------------------------------------
If you wanted to make a package called Base::Spline, how would you do it?
Cheers,
Nige
