Hello.
Please, put attention to following non-runnable due to linker errors sample http://dpaste.dzfl.pl/cad4b558.

I suspect that that NVI support is broken, because (my guess) linker assumes that interface should implement functions and doesn't look to class definition.

After reading relevant section in TDPL I found another issue: according to p.215 bar() and baz() may have (or even should) 'override' specifier, but currently dmd rejects it. Moreover, dmd is irrelevant about whether 'bar' and 'baz' functions (within class definition) are specified with private keyword or not: is is a bug or intentional behavior?

If interface implements functions, which are called from another of interface's functions, linking goes fine. However, after rereading relevant TDPL paragraph and this Alexandrescu post [1] I think that the trick is that functions 'bar' and 'baz' are implemented *not* in interface but in class-implementer.

Furthermore, if function declarations are converted to empty definitions keeping the same class definitions, dmd accepts this ambiguity (class A.bar() and interface I.bar()) and gives priority to interface's functions on calling them.

So, is this a bug or my NVI misunderstanding is wrong and what is D design policy in this issue?

[1] http://digitalmars.com/d/archives/digitalmars/D/The_Non-Virtual_Interface_idiom_in_D_96739.html

Reply via email to