Eigenpoll : D wish list : Built-in variant type 

It would be great to have build into D language variant (something similar to boxer from phobos) type. It's generally usefull type in some situation and it will also improve D itself:
Instead of using special variables _arguments when passing variadic number of different type arguments you will just use same syntax like when passing variadic number of string, ints etc.:
void foo(variant[] arg ...)
void foo(int[] arg ...)
void foo(char[][] arg ...)

Implementing variant in language should not be very difficult and it should be better than implementing it on D language level (templates). Variant type should have property like .undertype which would show containing datatype.


Report this item for cleanup