digitalmars.D - Is there a reason why there's no way to manually pass args to variadic
- QAston (16/16) Feb 15 2014 There's a design pattern in D which dates back to C - for every
There's a design pattern in D which dates back to C - for every vararg function there's a v*function*(Typeinfo, void*) sibling function which allows one to wrap the function in another variadic. You can see an example here: http://dlang.org/phobos/std_stream.html#.InputStream.vreadf Why is this C pattern preserved in D? I think it should be possible to pass Typeinfo-Vararg pair into function(...) without the need for vfunction(Typeinfo, void*) as those parameters arrays are probably generated on the caller side anyways? This pattern is problematic because a-very-smart-library-designer may forget to add a v- function variant (in which case users are screwed), and it cripples metaprogramming (for example for my mocking library). And yeah, I know this is easy to with template methods but those can't be used in interfaces because they're compile time entities.
Feb 15 2014