Fully dynamic d by opDotExp overloading

Christopher Wright dhasenan at gmail.com
Fri Apr 17 15:08:59 PDT 2009


Andrei Alexandrescu wrote:
> Yah, glad someone mentioned it :o). The best way is a blend - you can 
> statically dispatch on some popular/heavily-used names, then rely on a 
> hashtable lookup for dynamic stuff.
> 
> Andrei


You suggest:

auto opDotExp(string name)(...)
{
	static if (name == "something")
	{
		code...
	}
	else
	{
		dynamic stuff
	}
}

That isn't very clear. Why not write it this way:

auto opDotExp(string name, ...)
{
	dynamic stuff
}

auto something (...)
{
	code...
}



More information about the Digitalmars-d mailing list