static static

bearophile bearophileHUGS at lycos.com
Tue Nov 10 13:56:11 PST 2009


Steven Schveighoffer:

> What's the advantage over:
> 
> static int y;
> 
> T foo(T)(T x) {
>     // ...
> }

That the global name space is kept clean, the "y" name can be seen only inside foo. Reducing the visibility of names is useful to keep things tidy. (Inside normal functions in D static has just that purpose).

Bye,
bearophile



More information about the Digitalmars-d mailing list