www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - private module symbols

reply Flo <the_big_flo web.de> writes:
Hi,

Im kinda confused about the protection attributes on module level.
The case:
I've got 2 modules.
test1.d

module test1;

import test2;

int main(char[][] args)
{
	Test2Struct s;
	return 0;
}

and test2.d

module test2;

private struct Test2Struct
{
	int var;
}


From my understanding of the docs, i shouldn't be able to use the struct in
test1. But it compiles and runs fine and so i'm not sure how to hide symbols to
other modules. Is it possible at all?

(oh and im using dmd 1.043)
Apr 10 2009
parent reply Gide Nwawudu <gide btinternet.com> writes:
On Fri, 10 Apr 2009 05:24:24 -0400, Flo <the_big_flo web.de> wrote:

Hi,

Im kinda confused about the protection attributes on module level.
The case:
I've got 2 modules.
test1.d

module test1;

import test2;

int main(char[][] args)
{
	Test2Struct s;
	return 0;
}

and test2.d

module test2;

private struct Test2Struct
{
	int var;
}


From my understanding of the docs, i shouldn't be able to use the struct in
test1. But it compiles and runs fine and so i'm not sure how to hide symbols to
other modules. Is it possible at all?

(oh and im using dmd 1.043)
Looks like a variant of bug 314. http://d.puremagic.com/issues/show_bug.cgi?id=314 Gide
Apr 10 2009
next sibling parent Flo <the_big_flo web.de> writes:
Gide Nwawudu Wrote:

 
 Looks like a variant of bug 314.
 http://d.puremagic.com/issues/show_bug.cgi?id=314
 
 Gide
I see. Although this means its not only a problem with static, selective or renamed imports but with importing in general. And I think this is a severe one since protection is kinda important to OO programming. Flo
Apr 12 2009
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Gide Nwawudu wrote:
<snip>
 Looks like a variant of bug 314.
 http://d.puremagic.com/issues/show_bug.cgi?id=314
Actually, it's this one http://d.puremagic.com/issues/show_bug.cgi?id=2830 Stewart.
Apr 19 2009