Overloading/Inheritance issue

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sat Aug 4 15:17:38 PDT 2007


Walter Bright wrote:
> 
> 4) Having overloads spread across the inheritance hierarchy makes the 
> source code resistant to visual audits. For any method call, you'll have 
> to look at EVERY base class to see if it has an overload that is a 
> better match.
> 

I'm not sure if you've seen my other reply to this argument, but let be 
more explicit, with pictures. Let's say you have such a big inheritance 
hierarchy, with overloads spread across it.

This is a picture of one using a tool to list all possible overloads, 
without have to look at EVERY base class:
http://web.ist.utl.pt/bruno.d.o.medeiros/dee/ide_overload_completion.png
It shows you the signatures of all overloads (as well as the class that 
they belong to).

This is a picture of one calling that function with a literal, and 
having the tool automatically list which overload is being called:
http://web.ist.utl.pt/bruno.d.o.medeiros/dee/ide_overload_lookup.png
The yellow popup shows the signature of the invoked overload, which we 
can see is the one with the long parameter. How easy! You don't even 
have to recall the specifics of the lookup rules of the language.
(note that that popup appears just by placing the mouse cursor over 
"set", there is not even a need to invoke an explicit command)

D's syntax makes it as easy to build these tools as Java, C#, Ruby, 
etc.. (which is *way* easier than doing it for C++)

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list