Automatic method overriding in sub-classes

Shammah Chancellor via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 28 13:04:39 PDT 2015


On Monday, 26 October 2015 at 23:25:49 UTC, Tofu Ninja wrote:

> So we have TemplateThisParameters methods which are cool but 
> have some drawbacks.
> They are templates so they are implicitly non-virtual and are 
> called based on the type of the reference.
> It would be very nice to be able to auto generate method 
> overrides based on the this type with out having to drop a 
> mixin in every sub class.
> This would be very useful for CT-reflection.
> I will call this new feature auto override methods for the rest 
> of this post.

This kind of magic is detrimental to being able to reason about 
the code you are writing.  If libraries do this for example, 
there's too much spooky action-at-a-distance occurring.  Having 
explicit mixins is the appropriate way to handle this.


More information about the Digitalmars-d mailing list