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?
Scenario narrowed down:
// module foo;
class Foo
{
private:
bool _baz;
public:
final void foos(T : Foo)(string key, T[] values)
{
if (values && values.length)
{
foreach (child; values)
{
child._isChild = true;
}
}
}
}
// module bar;
class Bar : Foo
{
}
The above in my case will give a deprecation warning that
"_baz" isn't visible from "Bar".
Well, template has nothing to do with it. Also, private members
in D are private to the module, not to the class. Here's a
reduced example:
--- foo.d ---
import bar;
class Foo
{
private bool baz;
}
void test(Bar b)
{
b.baz = true;
}
--- bar.d ---
import foo;
class Bar : Foo {}
void main()
{
test(new Bar);
}
https://wiki.dlang.org/DIP22 mentions something called "look-up
origin"; the meaning of that term is unclear to me...