Inheritance of purity

so so at so.so
Thu Feb 23 13:04:23 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. I grant you that 
> many D
> developers don't use IDEs at this point (at least not for D) 
> and that those
> sort of capabilities are likely to be in their infancy for the 
> IDEs that we
> _do_ have, but I really think that this is the sort of thing 
> that should be
> left up to the IDE. Inferring attribtutes like that is just 
> going to harm code
> maintainibility. It's bad enough that we end up with them not 
> being marked on
> templates due to inferrence, but we _have_ to do it that way, 
> because the
> attributes vary per instantiation. That is _not_ the case with 
> class member
> functions.
>
> Please, do _not_ do this.
>
> - Jonathan M Davis

As much as i hate the "pure const system trusted" spam, I don't 
think i like the idea either. If you are not using an IDE or a 
mouse, this would be hell. A language shouldn't be designed with 
such assumptions, unless you are Microsoft.

Thing is, this will make things harder not easier. (which i think 
is the intention here) When you overload a function, at most you 
copy/paste it from base class.


More information about the Digitalmars-d mailing list