January 13, 2006
Kris wrote:
> This is all fine & good, except for one thing;
> 
> Walter is rather unlikely to provide direct, explicit control over static ctors. It's just not that important right now. All I'm looking for is a qualification as to how the module static-ctor should behave with respect to contained class static-ctors ~ isn't that a much simpler, and straightforward, request?
> 
> At this point, the static module-ctor itself invokes any contained static class-ctors, *before* its own body is executed. This could just as easily be done afterwards, such that the management would at least follows a pattern we're all familiar with :: first in, last out.

True enough.  And it's what I'd expect to happen anyway.


Sean
January 15, 2006
The static constructors are invoked in lexical order. This makes for a simple rule, and if the programmer needs a different order, it can be easilly accomplished by having the static constructors call other functions.

The bug here is that the static destructors should be called in the reverse order.


January 31, 2006
Kris schrieb am 2006-01-12:
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> private import std.stdio;
>
> class Foo
> {
>         static this() {printf("class static ctor\n");}
>         static ~this() {printf("class static dtor\n");}
> }
>
> static this() {printf("static ctor\n");}
> static ~this() {printf("static dtor\n");}
>
> void main()
> {
> }
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
> emits the following:
>
> class static ctor
> static ctor
> class static dtor
> static dtor
>
>
> Surely the first two should be reversed? That is, the static ctor should invoke any static-class-ctors *after* its own body?

Added to DStress as http://dstress.kuehne.cn/norun/d/destructor_06.d

Thomas


1 2
Next ›   Last »