On Tuesday, 27 January 2015 at 18:18:02 UTC, Ali Çehreli wrote:
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

Thanks for comments, Mr. Professor. On duty as usual ;)
Let me here thank for your book which I've been reading for some time.

Piotrek

Reply via email to