Re: Template method in interfaces

2016-08-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/10/16 12:41 PM, Arafel wrote: I have to say that the fact that this compiles at all seems like a bug to me according to [1], even more so that the method in A is called: That is definitely a bug. D ignores many misplaced attributes, but not override. -Steve

Re: Template method in interfaces

2016-08-10 Thread Arafel via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:52:29 UTC, Lodovico Giaretta wrote: On Wednesday, 10 August 2016 at 15:48:10 UTC, Lodovico Giaretta wrote: On Wednesday, 10 August 2016 at 15:39:19 UTC, Arafel wrote: Would it even make sense to "force" (deprecation warning) a "final" keyword in any implicitly

Re: Template method in interfaces

2016-08-10 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:54:42 UTC, Adam D. Ruppe wrote: On Wednesday, 10 August 2016 at 15:48:10 UTC, Lodovico Giaretta wrote: I read the spec again, and found out that it says interfaces cannot contain templated functions... So either my interpretation is the intended one and the sp

Re: Template method in interfaces

2016-08-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:48:10 UTC, Lodovico Giaretta wrote: I read the spec again, and found out that it says interfaces cannot contain templated functions... So either my interpretation is the intended one and the spec is outdated, or the spec is right and the compiler is bugged.

Re: Template method in interfaces

2016-08-10 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:48:10 UTC, Lodovico Giaretta wrote: On Wednesday, 10 August 2016 at 15:39:19 UTC, Arafel wrote: Would it even make sense to "force" (deprecation warning) a "final" keyword in any implicitly-final function (I wasn't even aware of those, I have to admit)? It wou

Re: Template method in interfaces

2016-08-10 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:39:19 UTC, Arafel wrote: On Wednesday, 10 August 2016 at 15:25:40 UTC, Lodovico Giaretta wrote: Because templated functions cannot be virtual, it follows that I.func is final. Having no body, the compiler thinks that its body will be found by the linker in ano

Re: Template method in interfaces

2016-08-10 Thread Arafel via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:25:40 UTC, Lodovico Giaretta wrote: Because templated functions cannot be virtual, it follows that I.func is final. Having no body, the compiler thinks that its body will be found by the linker in another object file, but this does not happen, so the linker co

Re: Template method in interfaces

2016-08-10 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 15:20:37 UTC, Arafel wrote: I'm not sure if the following is even expected to work, since I'm not sure how the vtable for the interface would look like (well, that would be applicable to any overriden templated method, though): --- public interface I {

Template method in interfaces

2016-08-10 Thread Arafel via Digitalmars-d-learn
I'm not sure if the following is even expected to work, since I'm not sure how the vtable for the interface would look like (well, that would be applicable to any overriden templated method, though): --- public interface I { void func(T)(T t); } public class C : I { void func(