On 01/27/2015 08:58 AM, Piotrek wrote:

Nice list. :)

> 1. static variable
>
> struct A{int a} // no static before declaration
> static A s; //note that static is used for struct variable storage class
> (lifetime)
>
> static int b;
> etc.
>
> 2. static declaration
>
> static struct A{int a}; //static used for context unnesting
> static int fun(){}; // static used also for removing scope context

Of course that includes static member functions, where the 'this' pointer is removed.

Actually, "static opCall" is kind of different because it makes the type itself callable.

>
> etc.
>
> 3. static if
>
> static if(compile_time_cond)
> {
>    //this section of code will be taken into the binary, used for meta
> programming
> }

Another use of 'static' that means "at compile time":

static assert

4. Module initialization and deinitialization:

static this
shared static this

static ~this
shared static ~this

5. Module import:

static import std.stdio;

Ali

Reply via email to