Thread overview
private with module name support
Aug 09, 2019
Newbie2019
Aug 09, 2019
Newbie2019
Aug 09, 2019
12345swordy
Aug 09, 2019
Newbie2019
August 09, 2019
When init a projects, or design encapsulation  type. It is frequently feed need to made some target only accept by one special module(not package but only module).

With current solution, I has to use package(Player) , this is not perfect because people can modify package name to made the resource accessible.  This is also not work well for a package.d module(not able to access from same folder).

the code look like this:

=======================
module PlayerImplement;

private(Player) void doSomeThing(){

}

=======================
module Player;
import PlayerImplement;
void doKill(){
       doSomeThing();
}

=======================

Is this make any sense ?





August 09, 2019
On Friday, 9 August 2019 at 01:17:28 UTC, Newbie2019 wrote:
> Is this make any sense ?


The app init function basic only call once, and call from the app entry pointer,  do so can avoid other module unexpected call component init function(right now I guard it with a global inited var).

I know class inheritance also can do the trick, but class has extra cost so not suit for simple case.



August 09, 2019
On Friday, 9 August 2019 at 01:24:30 UTC, Newbie2019 wrote:
> On Friday, 9 August 2019 at 01:17:28 UTC, Newbie2019 wrote:
>> Is this make any sense ?
>
>
> The app init function basic only call once, and call from the app entry pointer,  do so can avoid other module unexpected call component init function(right now I guard it with a global inited var).
>
> I know class inheritance also can do the trick, but class has extra cost so not suit for simple case.

Are you trying to implement the functionality as if it were C? Look into .di files.
August 09, 2019
On Friday, 9 August 2019 at 01:40:01 UTC, 12345swordy wrote:
> Are you trying to implement the functionality as if it were C? Look into .di files.

di file will not solve the problem,  and in most case the public interface(or api) and implement part in same package, use di make no sense.

This new feature allow to split complex source code from one file into multi, without losing the type protection from outside.