CRTP + compile-time introspection + static ctors = WIN

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jan 18 15:37:43 UTC 2021


On Sat, Jan 16, 2021 at 07:57:12AM +0000, Mathias LANG via Digitalmars-d wrote:
> On Friday, 15 January 2021 at 18:31:18 UTC, H. S. Teoh wrote:
> > 
> > And since static this() blocks are run at program startup and
> > dynamic library load time, this ensures that after program startup,
> > `classLoaders` has knowledge of all types the program will ever use.
> 
> Just don't use separate compilation or you're in for a lot of
> troubles.
> https://issues.dlang.org/show_bug.cgi?id=20641

Hmm, interesting.  Though in this case I'm not overly concerned since
registering the same type multiple times is harmless. :-D


T

-- 
"Computer Science is no more about computers than astronomy is about telescopes." -- E.W. Dijkstra


More information about the Digitalmars-d mailing list