xxxxxxxxxx
import std.stdio;
void foo(int a)
{
writeln(a);
}
void bar(NamedArgument!("b", int) b)
{
writeln(b);
}
struct NamedArgument(string name, T)
{
T value;
alias value this;
}
struct NamedArgumentProxy
{
auto opDispatch(string name, T)(T value) const
{
return NamedArgument!(name, T)(value);
}
}
immutable NamedArgumentProxy na;
void main()
{
foo(na.a = 3);
foo(na.b = 4);
}