in reply to Built-in Function Homonyms for Method Names Bad, Too?

An update on this debate.

I have decided to avoid homonym method names. Well, I just spent 2 hours trying to figure out a bug that was caused by almost exactly this problem. I am using Object::InsideOut, and I was writing a module/Class for locking. So, of course, you can set locks, right? So in my calling code I have:

my $lock = My::Lock->new(blah => blah); $lock->set();

Well, I forgot about OIO's ->set() Class method that is used for setting attributes inside class code. And, of course, I'm using that exact Class method inside a private method in Lock.pm which is itself called by my regular public method ->set(). So, of course, I've got a recursion nightmare. Add to that I accidentally had my $self = @_; instead of my $self = shift; for that private method, and man do you have a puzzler.

So I was unintentionally overriding a Class method in the same class that I was counting on using the parent level method. All with a scalar return context problem for the object ID to throw me off even more.