www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - traits allMembers and imported modules

reply "cal" <callumenator gmail.com> writes:
DMD 2.062:

//-- module other.d, same dir as main --
module other;
int j;
//--

//-- module dir/other.d, subdir of main --
module dir.other;
int j;
//--


//-- module main.d --
module main;

import other;
pragma(msg, [__traits(allMembers, (other))]);

import dir.other;
pragma(msg, [__traits(allMembers, dir.other)]);

void main(){}
//--

When the module name I use inside __traits is in the same dir as 
the main module, I need the extra parenthesis to satisfy the 
compiler. Is this a bug, or unavoidable?
Mar 11 2013
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/11/13, cal <callumenator gmail.com> wrote:
 When the module name I use inside __traits is in the same dir as
 the main module, I need the extra parenthesis to satisfy the
 compiler. Is this a bug, or unavoidable?
I can't reproduce this. How are you compiling the modules?
Mar 11 2013
parent reply "cal" <callumenator gmail.com> writes:
On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic wrote:
 On 3/11/13, cal <callumenator gmail.com> wrote:
 When the module name I use inside __traits is in the same dir 
 as
 the main module, I need the extra parenthesis to satisfy the
 compiler. Is this a bug, or unavoidable?
I can't reproduce this. How are you compiling the modules?
Both rdmd and separate compilation give the error: Import other has no members. if i remove the parenthesis around 'other'.
Mar 11 2013
next sibling parent reply "cal" <callumenator gmail.com> writes:
On Monday, 11 March 2013 at 23:19:18 UTC, cal wrote:
 On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic wrote:
 On 3/11/13, cal <callumenator gmail.com> wrote:
 When the module name I use inside __traits is in the same dir 
 as
 the main module, I need the extra parenthesis to satisfy the
 compiler. Is this a bug, or unavoidable?
I can't reproduce this. How are you compiling the modules?
Both rdmd and separate compilation give the error: Import other has no members. if i remove the parenthesis around 'other'.
Actually it prints out: [false] ["object", "j"] first, and then fails with the above error message.
Mar 11 2013
parent "cal" <callumenator gmail.com> writes:
On Monday, 11 March 2013 at 23:22:42 UTC, cal wrote:
 On Monday, 11 March 2013 at 23:19:18 UTC, cal wrote:
 On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic
 I can't reproduce this. How are you compiling the modules?
Specifically: dmd main.d other.d dir/other.d produces: Error: import other has no members [false] ["object", "j"]
Mar 11 2013
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/12/13, cal <callumenator gmail.com> wrote:
 if i remove the parenthesis around 'other'.
Ah yes, I can recreate it now. Can you file this as a bug?
Mar 11 2013
parent "cal" <callumenator gmail.com> writes:
On Monday, 11 March 2013 at 23:38:20 UTC, Andrej Mitrovic wrote:
 On 3/12/13, cal <callumenator gmail.com> wrote:
 if i remove the parenthesis around 'other'.
Ah yes, I can recreate it now. Can you file this as a bug?
Sure thanks for checking it
Mar 11 2013
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/12/13, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 On 3/12/13, cal <callumenator gmail.com> wrote:
 if i remove the parenthesis around 'other'.
Ah yes, I can recreate it now. Can you file this as a bug?
Ok I filed it: http://d.puremagic.com/issues/show_bug.cgi?id=9692
Mar 11 2013