Thread overview | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 02, 2015 Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
I am working on dip which will try to addressed negation of attributes issue. http://wiki.dlang.org/DIP79 |
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Kozak | 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:". |
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Liam McSherry | 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.
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Kozak | On Tuesday, 2 June 2015 at 10:29:35 UTC, Daniel Kozak wrote:
> I am working on dip which will try to addressed negation of attributes issue.
> http://wiki.dlang.org/DIP79
You propose to add extra difficulty to the language and the only reason is "If you need add few methods which are virtual or variables, you are forced to put them before final:. This is too limiting.".
I think it's a bad idea.
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace Attachments: | On Tue, 02 Jun 2015 11:50:15 +0000, Namespace wrote: > For me it looks ugly. But I would prefer final(false) instead of !final. this opens a can of worms. should this be accepted too: enum doItFinal = false; final(doItFinal) ? or even final(someFunnyTemplate!(with_, args, andOtherTemplate!"too")) ? |
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar |
On Tue, 2 Jun 2015 12:21:23 +0000 (UTC)
ketmar via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Tue, 02 Jun 2015 11:50:15 +0000, Namespace wrote:
>
> > For me it looks ugly. But I would prefer final(false) instead
> > of !final.
>
> this opens a can of worms. should this be accepted too:
> enum doItFinal = false;
> final(doItFinal)
> ?
>
> or even
> final(someFunnyTemplate!(with_, args, andOtherTemplate!"too"))
> ?
Exactly
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Tuesday, 2 June 2015 at 12:21:23 UTC, ketmar wrote:
> On Tue, 02 Jun 2015 11:50:15 +0000, Namespace wrote:
>
>> For me it looks ugly. But I would prefer final(false) instead of !final.
>
> this opens a can of worms. should this be accepted too:
> enum doItFinal = false;
> final(doItFinal)
> ?
>
> or even
> final(someFunnyTemplate!(with_, args, andOtherTemplate!"too"))
> ?
Yes, please.
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace Attachments: | On Tue, 02 Jun 2015 13:16:49 +0000, Namespace wrote:
> On Tuesday, 2 June 2015 at 12:21:23 UTC, ketmar wrote:
>> On Tue, 02 Jun 2015 11:50:15 +0000, Namespace wrote:
>>
>>> For me it looks ugly. But I would prefer final(false) instead of
>>> !final.
>>
>> this opens a can of worms. should this be accepted too:
>> enum doItFinal = false;
>> final(doItFinal)
>> ?
>>
>> or even
>> final(someFunnyTemplate!(with_, args, andOtherTemplate!"too"))
>> ?
>
> Yes, please.
no, please. that's terrible, that's unpredictable, that's undebugable, that's slow. "we can make it dynamic" is not a good reason to actually make something dynamic.
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace |
On Tue, 02 Jun 2015 13:16:49 +0000
Namespace via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Tuesday, 2 June 2015 at 12:21:23 UTC, ketmar wrote:
> > On Tue, 02 Jun 2015 11:50:15 +0000, Namespace wrote:
> >
> >> For me it looks ugly. But I would prefer final(false) instead of !final.
> >
> > this opens a can of worms. should this be accepted too:
> > enum doItFinal = false;
> > final(doItFinal)
> > ?
> >
> > or even
> > final(someFunnyTemplate!(with_, args, andOtherTemplate!"too"))
> > ?
>
> Yes, please.
It would be a disaster ;-)
|
June 02, 2015 Re: Negation of attributes (DIP 79) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ref2401 | On Tuesday, 2 June 2015 at 12:13:47 UTC, ref2401 wrote:
> On Tuesday, 2 June 2015 at 10:29:35 UTC, Daniel Kozak wrote:
>> I am working on dip which will try to addressed negation of attributes issue.
>> http://wiki.dlang.org/DIP79
>
> You propose to add extra difficulty to the language and the only reason is "If you need add few methods which are virtual or variables, you are forced to put them before final:. This is too limiting.".
> I think it's a bad idea.
This is by far not the only reason. It is just as well useful for all other attributes: const, pure, @safe/@system, @nogc, and maybe UDAs.
It's long been recognized that a mechanism to switch off a scope-wide attribute would be useful.
|
Copyright © 1999-2021 by the D Language Foundation