arsd.mvd

mvd stands for Multiple Virtual Dispatch. It lets you write functions that take any number of arguments of objects and match based on the dynamic type of each of them.

void foo(Object a, Object b) {} // 1
void foo(MyClass b, Object b) {} // 2
void foo(DerivedClass a, MyClass b) {} // 3

Object a = new MyClass();
Object b = new Object();

mvd!foo(a, b); // will call overload #2

The return values must be compatible; mvd will return the least specialized static type of the return values (most likely the shared base class type of all return types, or void if there isn't one).

All non-class/interface types should be compatible among overloads. Otherwise you are liable to get compile errors. (Or it might work, that's up to the compiler's discretion.)

Members

Functions

mvd
CommonReturnOfOverloads!fn mvd(T args)

See details on the arsd.mvd page.

Templates

CommonReturnOfOverloads
template CommonReturnOfOverloads(alias fn)

This exists just to make the documentation of mvd nicer looking.

Meta