Inheritance of purity

dsimcha dsimcha at yahoo.com
Fri Feb 17 07:39:48 PST 2012


On Friday, 17 February 2012 at 03:24:50 UTC, Jonathan M Davis 
wrote:
> No. Absolutely not. I hate the fact that C++ does this with 
> virtual. It makes it so that you have to constantly look at the 
> base classes to figure out what's virtual and what isn't. It 
> harms maintenance and code understandability. And now you want 
> to do that with @safe, pure, nothrow, and const? Yuck.
>
> I can understand wanting to save some typing, but I really 
> think that this harms code maintainability. It's the sort of 
> thing that an IDE is good for. It does stuff like generate the 
> function signatures for you or fill in the attributes that are 
> required but are missing.

Besides the fact that not everyone uses an IDE, my other 
counter-argument to these "the IDE generates your boilerplate" 
arguments is that code is read and modified more often than it is 
written.  I don't like reading or modifying boilerplate code any 
more than I like writing it.  Besides, if you're using a fancy 
IDE, can't it show you the protection attributes inherited from 
the derived class?


More information about the Digitalmars-d mailing list