Thread overview | |||||
---|---|---|---|---|---|
|
September 10, 2013 No 'is not implemented' message with final? | ||||
---|---|---|---|---|
| ||||
Code: ---- import std.stdio; interface A { public: final void bar(); } class B : A { } void main() { } ---- No message. But: ---- import std.stdio; interface A { public: void bar(); } class B : A { } void main() { } ---- Gives the correct error message: Error: class B interface function 'void bar()' is not implemented Bug or feature? |
September 10, 2013 Re: No 'is not implemented' message with final? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | > Bug or feature?
You will get a linker error when you try to use the function.
This is a feature, because you can implement this function later or even in another module (and set mangling to match).
Example of the former:
-----
interface A {
public:
final void bar(); // declaration
/** ... */
final void bar() { } // implementation
}
-----
For the latter:
-----
interface A {
public:
final void bar();
}
class B : A {
}
pragma(mangle, A.bar.mangleof)
void A_bar_impl(A _this) { }
-----
The mangle pragma feature is new in git-head.
|
September 10, 2013 Re: No 'is not implemented' message with final? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On Tuesday, 10 September 2013 at 21:03:57 UTC, Andrej Mitrovic wrote:
>> Bug or feature?
>
> You will get a linker error when you try to use the function.
>
> This is a feature, because you can implement this function later or
> even in another module (and set mangling to match).
>
> Example of the former:
>
> -----
> interface A {
> public:
> final void bar(); // declaration
>
> /** ... */
>
> final void bar() { } // implementation
> }
> -----
>
> For the latter:
>
> -----
> interface A {
> public:
> final void bar();
> }
>
> class B : A {
> }
>
> pragma(mangle, A.bar.mangleof)
> void A_bar_impl(A _this) { }
> -----
>
> The mangle pragma feature is new in git-head.
Ah, thanks for explanation.
|
Copyright © 1999-2021 by the D Language Foundation