Template alias parameter mixin import inference

Simen Kjaeraas simen.kjaras at gmail.com
Mon Mar 31 03:25:15 PDT 2008


The below code does not compile - it complains about writefln not being  
defined,
which of course it is not, in module b. Would it be possible to get import
inference for this sort of thing? I know it's currently as simple as  
placing
import statements within the "bar" template, but it seems to me this could  
have
been done in a more pleasant way.

//////////////////////

module a;
import std.stdio;

template bar()
{
	int i;
	
	void func()
	{
		writefln(i);
	}
}

void main()
{
	foo!(bar) a;
	a.func();
}

//////////////////////

module b;

struct foo(alias T)
{
	mixin T!();
}

//////////////////////

--Simen



More information about the Digitalmars-d mailing list