digitalmars.D - Template alias parameter mixin import inference
- Simen Kjaeraas (33/33) Mar 31 2008 The below code does not compile - it complains about writefln not being ...
- Jarrett Billingsley (3/6) Mar 31 2008 public import std.stdio;
- Jarrett Billingsley (3/10) Mar 31 2008 Ignore me. Thought I saw an "import a;" in module b. ._.
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
Mar 31 2008
"Simen Kjaeraas" <simen.kjaras gmail.com> wrote in message news:op.t8vlwdfy1hx7vj spill04.lan...////////////////////// module a; import std.stdio;public import std.stdio;
Mar 31 2008
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:fsqn0b$i7h$1 digitalmars.com..."Simen Kjaeraas" <simen.kjaras gmail.com> wrote in message news:op.t8vlwdfy1hx7vj spill04.lan...Ignore me. Thought I saw an "import a;" in module b. ._.////////////////////// module a; import std.stdio;public import std.stdio;
Mar 31 2008