mixin module template -> undefined identifier

2013-10-03 Thread Robert Schadek
I have some found some irregular behavior when using mixins with template and modules. If a aggregation is defined in the same module it is found. If the aggregation is defined in another module it fails. And I wonder if this is be design. For comparison see the code below. // file: moduleA.d mod

Re: mixin module template -> undefined identifier

2013-10-03 Thread David Nadlinger
On Thursday, 3 October 2013 at 17:52:13 UTC, Robert Schadek wrote: // file: moduleA.d module A; public int func(T)() { return mixin(T.stringof ~ ".fun()"); } […] dmd moduleA.d moduleB.d -ofmix -unittest moduleA.d(4): Error: undefined identifier Foo moduleB.d(10): Error: template instance

Re: mixin module template -> undefined identifier

2013-10-03 Thread Robert Schadek
On 10/03/2013 08:10 PM, David Nadlinger wrote: > On Thursday, 3 October 2013 at 17:52:13 UTC, Robert Schadek wrote: >> >> dmd moduleA.d moduleB.d -ofmix -unittest >> moduleA.d(4): Error: undefined identifier Foo >> moduleB.d(10): Error: template instance A.func!(Foo) error instantiating > > Yes, th

Re: mixin module template -> undefined identifier

2013-10-03 Thread Kenji Hara
2013/10/4 Robert Schadek > On 10/03/2013 08:10 PM, David Nadlinger wrote: > > On Thursday, 3 October 2013 at 17:52:13 UTC, Robert Schadek wrote: > >> > >> dmd moduleA.d moduleB.d -ofmix -unittest > >> moduleA.d(4): Error: undefined identifier Foo > >> moduleB.d(10): Error: template instance A.fun

Re: mixin module template -> undefined identifier

2013-10-03 Thread David Nadlinger
On Thursday, 3 October 2013 at 18:39:48 UTC, Robert Schadek wrote: Yes, it does not exists in the module but func is a template and I was under the impression symbols would be seen when instantiated. No. D doesn't have something like C++'s ADL where the template arguments lead to additional n

Re: mixin module template -> undefined identifier

2013-10-04 Thread Dicebot
P.S. I have tried contacting you in context of std.logger, is mail address mentioned on github valid one? If not, please ping me via public.dicebot.lv

Re: mixin module template -> undefined identifier

2013-10-04 Thread Dicebot
By spec name resolution for templates happens in declaration scope. Mixin templates are only exception. If referencing symbol from other module during code gen is a unavoidable necessity, you should use instrospection on `T` and add its module into code gen as template-local import (something

Re: mixin module template -> undefined identifier

2013-10-04 Thread Robert Schadek
On 10/04/2013 09:07 AM, Dicebot wrote: > P.S. I have tried contacting you in context of std.logger, is mail > address mentioned on github valid one? If not, please ping me via > public.dicebot.lv Yes it is, strange. Try the one I use here.

Re: mixin module template -> undefined identifier

2013-10-04 Thread Robert Schadek
On 10/04/2013 04:36 AM, David Nadlinger wrote: > Maybe you can elaborate a bit on how the problem occurs in that > context? As I said, I've found that usually it is possible to come up > with a design at least as pretty (or even prettier) but doesn't rely > on stringof trickery if one just stares a