On Saturday, 31 December 2016 at 15:05:00 UTC, Adam D. Ruppe wrote:
Consider the following:

with (import std.stdio) void process(File input) ;

Let's rewrite that to be:

template process() {
   import std.stdio;
   void process(File input) {

   }
}

I absolutely hate making functions templated if they don't have to be. It breaks a whole bunch of things and is not at all transparent to the user. You can't take its address, pass it as a delegate/function pointer, use certain traits to introspect it (e.g. isSomeFunction, ReturnType, etc.), not to mention how templates really don't work well with inheritance. This all goes out the window when you turn a regular function into a template.

Reply via email to