Why doesn't symbol wheelbarrowing work with function templates?
TommiT
tommitissari at hotmail.com
Thu Jun 13 02:53:52 PDT 2013
"symbol wheelbarrowing" = "making symbols in other module(s)
local to the current module"
(described in TDPL at page 148)
The problem:
-----------
module a;
int foo(int)
{
return 42;
}
int bar(T)(int)
{
return 42;
}
-----------
module b;
int foo(char)
{
return 3;
}
int bar(T)(char)
{
return 3;
}
-----------
module main;
import std.stdio;
import a;
import b;
// Works for foo:
alias foo = a.foo;
alias foo = b.foo;
// ...but not for bar:
alias bar = a.bar;
alias bar = b.bar; // Error: [1]
void main()
{
writeln(foo(int.init)); // 42
writeln(foo(char.init)); // 3
//writeln(bar!(int)(int.init));
//writeln(bar!(char)(char.init));
}
1. alias main.bar conflicts with alias main.bar
More information about the Digitalmars-d
mailing list