static static

Walter Bright newshound1 at digitalmars.com
Tue Nov 10 15:05:13 PST 2009


bearophile wrote:
> 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).

struct MyNameSpace
{
     static int y;

     T foo(T)(T x) { ... }
}




More information about the Digitalmars-d mailing list