static this sucks, we should deprecate it

Christopher Wright dhasenan at
Fri May 29 21:01:21 PDT 2009

Derek Parnell wrote:
> On Sat, 30 May 2009 03:52:44 +1200, Tim Matthews wrote:
>> Walter Bright wrote:
>>> It's unreliable because how do you specify the load order? And how does 
>>> the user relate that to the source semantics?
>> grauzone suggested this earlier:
>> static this {} //full dependencies (all import statements)
>> static this : a, b {} //only dependent from module a and b
>> static this : void {} //no dependencies at all
> Is there a situation in which the dependancies are not known by the coder
> writer? For example, linking in some object code that has a "static this{}"
> section and not having the source code for that object code.

file A.di:
void foo();

file B.d:
static this () { foo(); }

All bets are off. A more sophisticated object format can correct this.

More information about the Digitalmars-d mailing list