Any takers for http://d.puremagic.com/issues/show_bug.cgi?id=9673?
Rainer Schuetze
r.sagitario at gmx.de
Sun Mar 10 23:51:41 PDT 2013
On 11.03.2013 01:15, Timon Gehr wrote:
> On 03/11/2013 12:49 AM, Andrei Alexandrescu wrote:
>> On 3/10/13 4:41 PM, Rainer Schuetze wrote:
>>> My
>>> point is that import dependencies in D are more viral than C++ headers
>>> because you cannot even remove them in di-files (this would break
>>> initialization order).
>>
>> This is new. Could you please elaborate?
>>
>> Thanks,
>>
>> Andrie
>>
>
> It is not true. The initialization order is determined at run time.
An import is listed in the module info struct as a dependency, if it has
static constructors (or destructors) or if it imports modules that have
static constructors. If a di-file misses an import, it might not end up
in the imported modules list of an importing module, so the correct
order cannot be determined at runtime. ( Search the dmd source for
"needmoduleinfo", especially
https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L150
and
https://github.com/D-Programming-Language/dmd/blob/master/src/import.c#L344
)
Also, you might run into trouble when removing static
constructors/destructors from the di-file because of this.
More information about the Digitalmars-d
mailing list