@disable

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 14 15:46:33 PST 2010


Denis Koroskin wrote:
> On Thu, 14 Jan 2010 21:28:42 +0300, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> Pelle Månsson wrote:
>>> On 01/14/2010 03:55 PM, Leandro Lucarella wrote:
>>>> What is @disable supposed to be for?
>>>> http://www.dsource.org/projects/dmd/changeset/336
>>>>
>>>> Thanks.
>>>>
>>> #define STCdisable       0x2000000000LL // for functions that are not 
>>> callable
>>
>> The main idea is to allow creation of noncopyable types by marking 
>> this(this) as @disable.
>>
>> Noncopyable types are pivotal for a number of idioms important in 
>> concurrency and elsewhere.
>>
>>
>> Andrei
> 
> Why not just make it final abstract instead? For example, the following 
> works now:
> 
> // class can not be instantiated, serves just like a namespace
> abstract final class Namespace
> {
>     static void foo() { ... }
> }

It's about a struct, and it can be instantiated so it's not abstract 
even in principle.

Andrei



More information about the Digitalmars-d mailing list