DIP22 : Private symbol visibility

Dicebot m.strashun at gmail.com
Fri Feb 1 09:28:13 PST 2013


What is wrong about *.di in this regard? Have just checked:

--- main.d ---
import test;

void main()
{
     import std.stdio;
     writeln(func());
}
------

--- test.di ---
module test;
int func();
------

--- test_impl.d ---
module test;

int func()
{
     return private_func();
}

private int private_func()
{
     return 42;
}
------

--- shell ---
$ dmd -c main.d
$ dmd -c test_impl.d
$ dmd -ofa.out main.o test_impl.o
$ ./a.out
42
-------

Am I missing something? Seems legit and pretty close to C++ model 
to me. You trade CTFE capabilities for more explicit interface.


More information about the Digitalmars-d-announce mailing list