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
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
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
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
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
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
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
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.
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