@disable

Denis Koroskin 2korden at gmail.com
Thu Jan 14 15:38:46 PST 2010


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() { ... }
}



More information about the Digitalmars-d mailing list