I have been tasked with the odious chore of digging through someone else's incredibly complicated tool and associated library structure. Just now I am staring at a piece of code that takes the form...
do_a_whole_bunch_of_stuff() if $obj1 eq $obj2;
These scalars are not primitive strings, so clearly for this statement to be of any use, someone, somewhere in the inheritance hierarchy has overloaded the 'eq' operator. Now, in theory, I could go digging my way through the whole inheritance tree and try to find the "use overload" statement that is triggering the behavior, but that seems rather brutish. Another idea I had was to fire up the debugger and actually perform such a comparison, making note of the location to which execution jumped. This seems more elegant, though I can't help but wonder if there is a less hackish way.
One can perform code reflection on an object by poking around in the classes from its inheritance hierarchy, so as to deduce what methods are defined. Is there a similar paradigm that I might follow regarding operator overloading?