Automatic method overriding in sub-classes
bitwise via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 28 08:13:37 PDT 2015
On Tuesday, 27 October 2015 at 23:15:39 UTC, Tofu Ninja wrote:
> On Tuesday, 27 October 2015 at 22:23:15 UTC, bitwise wrote:
>> [...]
>
> -H also keeps the body of template functions so I would assume
> it would treat auto overrides the same.
>
Well.. It's not going to just work. Dmd will surely have to be
told what to do.
>> [...]
>
> I think you are correct, there is a scenario where one might
> want to provide a header to a class and not include the auto
> override body. An alternative solution could be that if you
> provide a header to a class and don't include the auto override
> body, then the auto override functionality is removed and the
> method is treated as a regular method from that point on(with
> the most recent version of the method being the one that is
> used). This would allow the class to still be inherited later
> on.
>
I have to disagree with this. A function's meaning should not
change because it's definition is removed.
>> [...]
>
> A.foo() or B.foo() seems to work instead of super.super.foo()
> or super.foo()
Ah, ok. I'll take your word for it(on my phone).
I'm wondering if it would be worth it to make a DIP for this. We
could sort out the details and discuss the use and ab-use cases ;)
I myself would be a bit reluctant to start on the DIP right this
second though, as I don't currently have the knowledge/time to
back it with a proof of concept implementation.
Bit
More information about the Digitalmars-d
mailing list