mixin module template -> undefined identifier

David Nadlinger code at klickverbot.at
Thu Oct 3 19:36:03 PDT 2013


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 names being introduced into the 
scope of the template body. This is by design.

> I mean the
> error starts with A.func!(Foo) error instantiating.

Sorry, I don't quite get what you mean here. The error is just a 
follow-up to the previous one, as the inability to look up Foo 
caused an error while instantiating that template.

> Not as easy to fix this as I have a library that generates me 
> sqlite
> code at compile time which I than mixin to have as good as 
> handwritten
> code. I just found it odd that it works if I instantiate the 
> template
> from the same module.

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 at the 
problem long enough. ;)

David


More information about the Digitalmars-d mailing list