On 13.03.2010 2:27, Michel Fortin wrote:
On 2010-03-12 19:10:10 -0500, Max Samukha <spam...@d-coding.com> said:

If static constructors in templates ran during the initialization of
the module where they are defined, the problem with mixed-in code
could be solved like this:

But templates can take function and types as argument. If the 'static
this' of a template calls something through one of its argument, the
module this function or type resides in needs to be initialized first.

So you can't always call a template's static this at the same time as
the module the template is defined in.


Yes that is the point and purpose.

The advantage is that the programmer is in control of when the static constructors in templated code are run - if you want the constructor to run in the context of the imported module use a regular template, otherwise, mixin.

I'd definitely preferred it over the current semantics. Others may disagree.


Reply via email to