@disable

Robert Clipsham robert at octarineparrot.com
Sat Jan 16 05:46:56 PST 2010


On 15/01/10 00:36, Leandro Lucarella wrote:
> Yes, I can read, but I wondered what's the point on making a function
> non-callable. It's absolutely contradictory! :)

Other than the no-copy idiom for structs, I'd find it useful in the 
following situation:

----
@disable void foo1() { }
int foo2( int a ) { return 1; }

void main()
{
     foo1();
}
----

When refactoring code I often find myself commenting out functions to 
check if I've got all the functions switched over, doing this saves that 
effort :) Of course I could mark them with deprecated and compile with 
-d, that means messing with my build script, something I'd rather avoid.

>
> Now I see it's intended only for compiler generated methods, and I think
> it's a seriously flawled feature.
>




More information about the Digitalmars-d mailing list