Luis Motta Campos luismottacampos at
Thu Jan 18 17:01:39 GMT 2007

On Jan 18, 2007, at 4:50 PM, Ovid wrote:
> A derived class should not change the parent's class interface.  That
> doesn't mean it can't change the behavior, but if you expect
> $parent->foo to return an arrayref of integers, $child->foo better do
> it, too.

   Well, there are certain languages that force you into this by  
having a two-barreled shotgun. There are other languages that just  
expect you to be educated... well, this is not a good argument anyways.

   We're plenty of uneducated people trying to program perl, and this  
means that Perl should use a shotgun sometimes. I wish I could just  
say something like

   use shotgun ':when needed';

   and have perl shoot down uneducated code. For example, preventing  
people from accessing my private methods (tagged as ":private" on sub  
declaration), or preventing extending classes from changing my  
interface (so, if I return an array of Foo, any overloaded methods  
should also return an array of Foo, so I can use polymorphism without  

Luis Motta Campos is software engineer,
perl fanatic evangelist, and amateur {cook, photographer}

More information about the mailing list