in reply to How to deal with old OO code that mixes instance methods with class methods
The thing is, if you have a method like:
sub get_name { my $self = shift; return "Bob"; }
... it's true that this implementation of get_name doesn't make use of $self to determine the return value. However, other implementations of get_name (perhaps in child classes, parent classes, or even sibling classes; perhaps in classes that have not been written yet, but might in the future) might need to refer to $self to return a value. Making get_name a method call rather than a function call is beneficial for polymorphism.
|
|---|