Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-08-30 Thread Elie Morisse via Digitalmars-d
On Thursday, 30 August 2018 at 12:18:10 UTC, Elie Morisse wrote: On Monday, 11 June 2018 at 15:41:57 UTC, Steven Schveighoffer wrote: I filed a bug about a similar thing (calling private functions instead of using private variables), but it seemed to be agreed upon that this is expected

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-08-30 Thread Elie Morisse via Digitalmars-d
On Monday, 11 June 2018 at 15:41:57 UTC, Steven Schveighoffer wrote: I filed a bug about a similar thing (calling private functions instead of using private variables), but it seemed to be agreed upon that this is expected behavior: https://issues.dlang.org/show_bug.cgi?id=15897 You may find

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-06-12 Thread bauss via Digitalmars-d
On Monday, 11 June 2018 at 15:41:57 UTC, Steven Schveighoffer wrote: On 4/11/18 3:13 PM, bauss wrote: On Wednesday, 11 April 2018 at 17:58:25 UTC, Jonathan M Davis wrote: On Sunday, April 08, 2018 13:00:02 bauss via Digitalmars-d wrote: [...] I don't know. It could be argued either way. I

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-06-11 Thread Steven Schveighoffer via Digitalmars-d
On 4/11/18 3:13 PM, bauss wrote: On Wednesday, 11 April 2018 at 17:58:25 UTC, Jonathan M Davis wrote: On Sunday, April 08, 2018 13:00:02 bauss via Digitalmars-d wrote: [...] I don't know. It could be argued either way. I think that the logic as to why [...] The thing is, it makes no

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread bauss via Digitalmars-d
On Wednesday, 11 April 2018 at 17:58:25 UTC, Jonathan M Davis wrote: On Sunday, April 08, 2018 13:00:02 bauss via Digitalmars-d wrote: [...] I don't know. It could be argued either way. I think that the logic as to why [...] The thing is, it makes no sense why it shouldn't be legal since

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread Timon Gehr via Digitalmars-d
On 11.04.2018 19:58, Jonathan M Davis wrote: I don't know. It could be argued either way. Not really. bauss is right about this. https://en.wikipedia.org/wiki/Liskov_substitution_principle

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread Jonathan M Davis via Digitalmars-d
, 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 >

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread bauss via Digitalmars-d
On Wednesday, 11 April 2018 at 17:20:23 UTC, martin wrote: On Monday, 9 April 2018 at 17:16:56 UTC, bauss wrote: On Monday, 9 April 2018 at 17:05:45 UTC, martin wrote:>> Actually, this behaves as i would expect. `_baz` is a private member of Foo (to be precise: it belongs to module `a`) in

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread bauss via Digitalmars-d
On Wednesday, 11 April 2018 at 17:34:40 UTC, bauss wrote: On Wednesday, 11 April 2018 at 17:20:23 UTC, martin wrote: On Monday, 9 April 2018 at 17:16:56 UTC, bauss wrote: On Monday, 9 April 2018 at 17:05:45 UTC, martin wrote:>> Actually, this behaves as i would expect. `_baz` is a private

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-11 Thread martin via Digitalmars-d
On Monday, 9 April 2018 at 17:16:56 UTC, bauss wrote: On Monday, 9 April 2018 at 17:05:45 UTC, martin wrote:>> Actually, this behaves as i would expect. `_baz` is a private member of Foo (to be precise: it belongs to module `a`) in handleBar(), you iterate `Bar[]` - which is in module `b`. By

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-09 Thread bauss via Digitalmars-d
On Monday, 9 April 2018 at 17:05:45 UTC, martin wrote: On Sunday, 8 April 2018 at 13:00:02 UTC, bauss wrote: 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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-09 Thread martin via Digitalmars-d
On Sunday, 8 April 2018 at 13:00:02 UTC, bauss wrote: 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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread bauss via Digitalmars-d
On Sunday, 8 April 2018 at 14:45:34 UTC, kdevel wrote: On Sunday, 8 April 2018 at 13:00:02 UTC, bauss wrote: [...] // a.d module a; class Foo { private: bool _baz; public: void handleBar(T : Foo)(T[] foos) { foreach (child;

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread nkm1 via Digitalmars-d
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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread Timon Gehr via Digitalmars-d
On 08.04.2018 16:36, Timon Gehr wrote: On 08.04.2018 15:00, bauss wrote: It's perfectly normal in other languages that supports classes to access private members of parent's as long as you're within the parent's encapsulation. That is not true. Use 'protected'. Actually, I misunderstood

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread kdevel via Digitalmars-d
On Sunday, 8 April 2018 at 13:00:02 UTC, bauss wrote: [...] // a.d module a; class Foo { private: bool _baz; public: void handleBar(T : Foo)(T[] foos) { foreach (child; foos) { child._baz

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread Timon Gehr via Digitalmars-d
On 08.04.2018 15:00, bauss wrote: It's perfectly normal in other languages that supports classes to access private members of parent's as long as you're within the parent's encapsulation. That is not true. Use 'protected'.

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread bauss via Digitalmars-d
, 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 foo;`) What do you mean? The problem is that "Foo" cannot ac

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread Tony via Digitalmars-d
On Saturday, 7 April 2018 at 20:14:49 UTC, bauss wrote: The above in my case will give a deprecation warning that "_baz" isn't visible from "Bar". Seems like a bug to me since I'm accessing "_baz" from "Foo" itself and not from "Bar" or is it by design that you can't do such thing. I

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-08 Thread user1234 via Digitalmars-d
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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-07 Thread bauss via Digitalmars-d
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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-07 Thread bauss via Digitalmars-d
On Saturday, 7 April 2018 at 20:46:39 UTC, bauss wrote: The problem is that "Foo" cannot access "_baz" without deperecation warning, but "_baz" is a part of "Foo". I'm not trying to access "_baz" directly from "Bar" except for that I call the templated function that access "_baz", but that

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-07 Thread user1234 via Digitalmars-d
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

Re: Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-07 Thread bauss via Digitalmars-d
On Saturday, 7 April 2018 at 20:14:49 UTC, bauss wrote: foreach (child; values) { child._isChild = true; } I forgot: _isChild should be _baz in the narrowed down version.

Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

2018-04-07 Thread bauss via Digitalmars-d
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