Jump to page: 1 25  
Page
Thread overview
Negation of attributes (DIP 79)
Jun 02, 2015
Daniel Kozak
Jun 02, 2015
Liam McSherry
Jun 02, 2015
Namespace
Jun 02, 2015
ketmar
Jun 02, 2015
Daniel Kozák
Jun 02, 2015
Namespace
Jun 02, 2015
ketmar
Jun 02, 2015
Namespace
Jun 02, 2015
ketmar
Jun 02, 2015
Namespace
Jun 02, 2015
ketmar
Jun 02, 2015
Daniel Kozák
Jun 02, 2015
Artur Skawina
Jun 02, 2015
ketmar
Jun 03, 2015
Artur Skawina
Jun 03, 2015
ketmar
Jun 03, 2015
Kenji Hara
Jun 03, 2015
tcak
Jun 02, 2015
ref2401
Jun 02, 2015
Marc Schütz
Jun 02, 2015
ref2401
Jun 02, 2015
Wyatt
Jun 02, 2015
Dejan Lekic
Jun 02, 2015
Namespace
Jun 02, 2015
Marc Schütz
Jun 02, 2015
Kapps
Jun 03, 2015
Jonathan M Davis
Jun 04, 2015
Daniel Kozák
Jun 04, 2015
ketmar
Jun 04, 2015
Jonathan M Davis
Jun 04, 2015
Daniel Kozák
Jun 04, 2015
Jonathan M Davis
Jun 04, 2015
Daniel Kozák
Jun 04, 2015
Meta
Jun 04, 2015
Kenji Hara
Jun 04, 2015
Iain Buclaw
Jun 04, 2015
Daniel Kozák
Jun 04, 2015
Jacob Carlborg
Jun 04, 2015
Daniel Kozák
Jun 04, 2015
iackhtak
June 02, 2015
I am working on dip which will try to addressed negation of attributes issue.
http://wiki.dlang.org/DIP79
June 02, 2015
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
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
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
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
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
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
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
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
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.
« First   ‹ Prev
1 2 3 4 5