On Sunday, 8 April 2018 at 10:48:19 UTC, user1234 wrote:
On Saturday, 7 April 2018 at 20:46:39 UTC, bauss wrote:
On Saturday, 7 April 2018 at 20:34:57 UTC, user1234 wrote:
On Saturday, 7 April 2018 at 20:14:49 UTC, bauss wrote:
jesus that became a long title.
Anyway as the title says, is it a bug that a parent class
that access its own private members from derived classes
gets deprecation warning?
If the import is selective no. (`import foo : Foo;`)
If the import is for the whole module i'd say yes. (`import
What do you mean?
The problem is that "Foo" cannot access "_baz" without
deperecation warning, but "_baz" is a part of "Foo".
_baz is private and not protected. The deprecation was
introduced because bug 314 broke the private protection.
I think it's better demonstrated like this, because to me the
behavior makes no sense.
Especially since you can just cast "Bar" to "Foo" and then you're
allowed to do it.
Since we're inside Foo then it shouldn't care whether "_baz" is
private or not.
I could understand if the function was located within Bar, but
It's perfectly normal in other languages that supports classes to
access private members of parent's as long as you're within the
void handleBar(T : Foo)(T foos)
foreach (child; foos)
child._baz = true; // Not ok.
(cast(Foo)child)._baz = true; // Ok.
class Bar : Foo
auto bars = [new Bar, new Bar];
auto bar = new Bar;