www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - private module members

reply "Dan" <dbdavidson yahoo.com> writes:
According to the spec, private module members are equivalent to 
static
declarations in C programs. Why does this work (i.e. print 5)?
Both imported.d and sample.d are in same directory 
(.../attributes).

Thanks
Dan

----------------------------------------------------------------------
import std.stdio;
import play.education.attributes.imported;

void main() {
   WhyIsAccessible s;
   writeln(s.x);
}
----------------------------------------------------------------------
module play.education.attributes.imported;
private:
struct WhyIsAccessible {
   int x = 5;
}
----------------------------------------------------------------------
Oct 16 2012
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Dan:

 Why does this work (i.e. print 5)?

It looks like a compiler bug/hole. DMD is not yet aligned to its specs... Is it in Bugzilla? Bye, bearophile
Oct 16 2012
prev sibling next sibling parent "Dan" <dbdavidson yahoo.com> writes:
On Tuesday, 16 October 2012 at 19:31:45 UTC, bearophile wrote:
 Dan:

 Why does this work (i.e. print 5)?

It looks like a compiler bug/hole. DMD is not yet aligned to its specs... Is it in Bugzilla? Bye, bearophile

Thanks. I had assumed my interpretation was incorrect and was just looking for an explanation. Honestly, until just now, I have not explored bugzilla. There is bug 1141 which looks like what I'm asking about and references a newer one 2830 which looks exactly like the issue. Thanks Dan
Oct 16 2012
prev sibling parent Oleg Kuporosov <oleg.kuporosov gmail.com> writes:
--bcaec501c59ade788504cc5310a1
Content-Type: text/plain; charset=ISO-8859-1

Is it in Bugzilla?

 Bye,
 bearophile

Thanks. I had assumed my interpretation was incorrect and was just looking for an explanation. Honestly, until just now, I have not explored bugzilla. There is bug 1141 which looks like what I'm asking about and references a newer one 2830 which looks exactly like the issue.

This is fixed issue in D2.061 alpha, but not in D1. Thanks, Oleg. --bcaec501c59ade788504cc5310a1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Is it in Bugzilla?<br><div class=3D"gmail_quote"><blockquote class=3D"gmail= _quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:= 1ex"><div class=3D"HOEnZb"><div class=3D"h5"><blockquote class=3D"gmail_quo= te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=

<br> Bye,<br> bearophile<br> </blockquote> <br></div></div> Thanks. I had assumed my interpretation was incorrect and was just looking = for an explanation. Honestly, until just now, I have not explored bugzilla.= There is bug 1141 which looks like what I&#39;m asking about and reference= s a newer one 2830 which looks exactly like the issue.<br> </blockquote><div><br></div><div>This is fixed issue in D2.061 alpha, but n= ot in D1.</div><div><br></div><div>Thanks,</div><div>Oleg.=A0</div></div> --bcaec501c59ade788504cc5310a1--
Oct 18 2012