tl; dr: How do you do great redirects to D?
The link has a great explanation, but, for example, let's say I have this method:
void foo(T)(in int a, out int b, ref int c, scope int delegate(ref const(T)) d) const nothrow { }
How to create another method bar() , which can be called instead of foo() , which subsequently calls foo() "excellent" (that is, without introducing the compilation problem / scope / etc on the calling site)
Naive approach
auto bar(T...)(T args) { writeln("foo() intercepted!"); return foo(args); }
of course does not work, because it does not process the ref , in , out , inout , const -ness of the method, pure -ity, nothrow , etc., and also limits how values ββcan be used with r values.
And I don't know how to handle these possible cases ... any ideas?
source share