Negation of attributes (DIP 79)
Namespace via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 2 04:50:15 PDT 2015
On Tuesday, 2 June 2015 at 11:07:21 UTC, Liam McSherry wrote:
> In the examples you give, you could surround the final methods
> in a final block. Testing with dmd 2.067.1, the following works:
>
> ---
> class C
> {
> final
> {
> void nonOverrideable()
> {
> "Hello, World!".writeln;
> }
> }
>
> bool overrideable()
> {
> return true;
> }
> }
>
> class D : C
> {
> override void nonOverrideable() // Error
> {
> "Goodbye!".writeln;
> }
>
> override bool overrideable() // No error
> {
> return false;
> }
> }
> ---
>
> To me, at least, it's also more intuitive than "!final:".
For me it looks ugly. But I would prefer final(false) instead of
!final.
More information about the Digitalmars-d
mailing list