Thread overview
traits allMembers and imported modules
Mar 11, 2013
cal
Mar 11, 2013
Andrej Mitrovic
Mar 11, 2013
cal
Mar 11, 2013
cal
Mar 11, 2013
cal
Mar 11, 2013
Andrej Mitrovic
Mar 11, 2013
cal
Mar 11, 2013
Andrej Mitrovic
March 11, 2013
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?
March 11, 2013
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?
March 11, 2013
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'.
March 11, 2013
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.
March 11, 2013
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"]
March 11, 2013
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?
March 11, 2013
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
March 11, 2013
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