Is Anything Holding you back?

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 7 03:03:10 PDT 2015


Am Wed, 07 Oct 2015 08:41:30 +0000
schrieb Jonathan M Davis <jmdavisProg at gmx.com>:

> On Wednesday, 7 October 2015 at 07:08:39 UTC, extrawurst wrote:
> > Method 1: Adding a static c'tor to every module does not work 
> > very long in practice (as experienced first handed) cause you 
> > are in "cyclic c'tor hell" very quick...
> 
> The cyclic dependency checking in druntime makes static 
> constructors almost unusable. It's a case of being protected so 
> much while trying to do something that you can't do what you're 
> trying to do. There really should be some way IMHO to have 
> something similar to @trusted where you tell the compiler/runtime 
> that the order does not matter for a particular static 
> constructor and that it should just trust the programmer on that, 
> but Walter rejected the idea when it was brought up.
> 
> - Jonathan M Davis

With LDC you can abuse the C constructor mechanism to do that. GDC does
not yet expose C constructors to D code but it's on my list and it's
easy to implement.


More information about the Digitalmars-d mailing list