Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 16, 2012 private module members | ||||
---|---|---|---|---|
| ||||
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; } ---------------------------------------------------------------------- |
October 16, 2012 Re: private module members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan | 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
|
October 16, 2012 Re: private module members | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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
|
October 18, 2012 Re: private module members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan Attachments:
| 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.
|
Copyright © 1999-2021 by the D Language Foundation