Thread overview
[Issue 19943] Field base access works for virtual methods
Jun 06, 2019
Basile-z
Jun 06, 2019
FeepingCreature
Jun 06, 2019
Basile-z
Mar 21, 2020
Basile-z
Dec 17, 2022
Iain Buclaw
June 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19943

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
I see this more as a feature.

It is occasionally useful and without that it would painfully hard (as seen in other languages that don't support this, some trickery with delegates and cast must be used) to call a less derived virtual method from a more derived type.

A use case is when you derive a class from a framework that you don't control and that its protection attributes or its class hierarchy have flaws. E.g: Some useful things are done in Framework.A, Only a small thing you want to avoid is done in Framework.B but your Own.C must derive from Framework.B because the rest is ok and you don't want to copy and paste 95% of Framework.B

--
June 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19943

--- Comment #2 from FeepingCreature <default_357-line@yahoo.de> ---
To me, the problem isn't that you're able to do it from Own.C, the problem is that you're able to do it from random.foo(), a function that is unrelated to the A inheritance hierarchy.

--
June 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19943

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
Okay I see. Maybe that outside this should behave like a cast, which then behaves like you expect, i.e the field can be read but virtual dispatching is not shortcut.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=19943

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19943

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--