www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Access specifiers and visibility

reply Andrew Edwards <edwards.ac gmail.com> writes:
Attempting to update a git repo to current D, I encounter the 
following deprecation messages:

src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
glwtf.input.BaseGLFWEventHandler._on_key_down is not visible from 
module glwtf.signals
src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
glwtf.input.BaseGLFWEventHandler._on_key_up is not visible from 
module glwtf.signals
src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
glwtf.input.BaseGLFWEventHandler._on_mouse_button_down is not 
visible from module glwtf.signals
src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
glwtf.input.BaseGLFWEventHandler._on_mouse_button_up is not 
visible from module glwtf.signals

The offending line of code in signal.d for all four messages is:

         _impl.addSlot(obj, cast(void 
delegate())mixin("&obj."~method));

these methods are implemented in the following default 
constructor:

     class BaseGLFWEventHandler : AEventHandler {
         // [...]
         this() {
             on_key_down.connect!"_on_key_down"(this);
             on_key_up.connect!"_on_key_up"(this);
             
on_mouse_button_down.connect!"_on_mouse_button_down"(this);
             
on_mouse_button_up.connect!"_on_mouse_button_up"(this);
         }
         // [...]
     }

Which are implemented in the following abstract class:

     abstract class AEventHandler {
         // input
         Signal!(int, int, int) on_key_down;
         Signal!(int, int, int) on_key_up;
         Signal!(int, int) on_mouse_button_down;
         Signal!(int, int) on_mouse_button_up;
     }

I'm not sure how to address this issue so am seeking guidance on 
how to update this code such that it complies with current D.

Thanks,
Andrew
May 09
next sibling parent reply Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote:
 Attempting to update a git repo to current D, I encounter the 
 following deprecation messages:

 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_down is not visible 
 from module glwtf.signals

 Thanks,
 Andrew
This comes from: http://dlang.org/changelog/2.071.0.html#dip22 The module glwtf.signals needs to import glwtf.input. One of the other imports was contaminating the namespace.
May 10
parent reply Andrew Edwards <edwards.ac gmail.com> writes:
On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips wrote:
 On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote:
 Attempting to update a git repo to current D, I encounter the 
 following deprecation messages:

 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_down is not visible 
 from module glwtf.signals

 Thanks,
 Andrew
This comes from: http://dlang.org/changelog/2.071.0.html#dip22 The module glwtf.signals needs to import glwtf.input. One of the other imports was contaminating the namespace.
I actually attempted solve the issue with selective import as such:: import glwtf.input : BaseGLFWEventHandler; but it did not work. Importing the entire module does not work either.
May 10
parent reply Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
On Wednesday, 10 May 2017 at 13:29:40 UTC, Andrew Edwards wrote:
 On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips wrote:
 On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards 
 wrote:
 Attempting to update a git repo to current D, I encounter the 
 following deprecation messages:

 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_down is not visible 
 from module glwtf.signals

 Thanks,
 Andrew
This comes from: http://dlang.org/changelog/2.071.0.html#dip22 The module glwtf.signals needs to import glwtf.input. One of the other imports was contaminating the namespace.
I actually attempted solve the issue with selective import as such:: import glwtf.input : BaseGLFWEventHandler; but it did not work. Importing the entire module does not work either.
I'm not sure the library you're using but this like the one: https://github.com/Dav1dde/glwtf/blob/master/glwtf/input.d#L163 This code says that the function is protected. https://github.com/Dav1dde/glwtf/blob/master/glwtf/signals.d#L254 This line is probably mixing in a call to that function into a struct https://github.com/Dav1dde/glwtf/blob/master/glwtf/signals.d#L229 But that struct doesn't inherit from the class so it can't access protected fields.
May 10
parent Andrew Edwards <edwards.ac gmail.com> writes:
On Thursday, 11 May 2017 at 04:35:22 UTC, Jesse Phillips wrote:
 On Wednesday, 10 May 2017 at 13:29:40 UTC, Andrew Edwards wrote:
 On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips 
 wrote:
 On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards 
 wrote:
 Attempting to update a git repo to current D, I encounter 
 the following deprecation messages:

 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_down is not visible 
 from module glwtf.signals

 Thanks,
 Andrew
This comes from: http://dlang.org/changelog/2.071.0.html#dip22 The module glwtf.signals needs to import glwtf.input. One of the other imports was contaminating the namespace.
I actually attempted solve the issue with selective import as such:: import glwtf.input : BaseGLFWEventHandler; but it did not work. Importing the entire module does not work either.
I'm not sure the library you're using but this like the one: https://github.com/Dav1dde/glwtf/blob/master/glwtf/input.d#L163 This code says that the function is protected. https://github.com/Dav1dde/glwtf/blob/master/glwtf/signals.d#L254 This line is probably mixing in a call to that function into a struct https://github.com/Dav1dde/glwtf/blob/master/glwtf/signals.d#L229 But that struct doesn't inherit from the class so it can't access protected fields.
That's not the same library but the exact same implementation. The one I'm using (https://github.com/d-gamedev-team/dimgui) borrows its from the deimos bindings. So since the a struct cannot inherit from a class and vice versa, then the entire approach taken by the library must be reconsidered going forward. A little over my head at this point. Thanks for the assist.
May 12
prev sibling parent John Colvin <john.loughran.colvin gmail.com> writes:
On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote:
 Attempting to update a git repo to current D, I encounter the 
 following deprecation messages:

 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_down is not visible 
 from module glwtf.signals
 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_key_up is not visible from 
 module glwtf.signals
 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_mouse_button_down is not 
 visible from module glwtf.signals
 src/glwtf/signals.d-mixin-256(256,2): Deprecation: 
 glwtf.input.BaseGLFWEventHandler._on_mouse_button_up is not 
 visible from module glwtf.signals
Those error messages are often misleading. The name of the symbol alone is (often, always?) right but the module/package it says it's from is often nonsense. I often get deprecation messages saying things like "myPackage.myModule.to is not visible from module myPackage.myOtherModule", when the real problem is I forgot to import std.conv in myPackage.myOtherModule.
May 13