'final' function implementations in interface definition

HOSOKAWA Kenchi hskwk at inter7.jp
Sun Jun 7 23:02:09 PDT 2009


Steve Schveighoffer Wrote:

> On Sun, 07 Jun 2009 19:52:05 -0400, HOSOKAWA Kenchi wrote:
> 
> > Steve Schveighoffer Wrote:
> > 
> > 
> >> f_twice can be a template:
> >> 
> >> void f_twice()(int i) { f(i); f(i); }
> >> 
> >> It's pretty much exactly what you want.  It should even work without
> >> explicit instantiation.
> >> 
> >> -Steve
> > 
> > I have tried to replace final function in the interface with your code.
> > finally I got following message. Error: function I.f_twice!().f_twice
> > template member function not allowed in interface I
> 
> I could have sworn I'd seen this or written something like this in 
> tango's log package...
> 
> It probably would be a good solution to this problem...
> 
> -Steve


perhaps it is depends on the language version.
At least both DMD 2.030 and 1.045 reject your suggestion.

If the function is macro- or inline-type, there is no need to instantiate it into the interface definition.
Your suggestion might be legal for the language design, I think.





More information about the Digitalmars-d mailing list