On Tuesday, 4 March 2014 at 12:01:46 UTC, John Colvin wrote:
On Tuesday, 4 March 2014 at 10:37:02 UTC, Steve Teale wrote:
On Tuesday, 4 March 2014 at 07:23:29 UTC, Jacob Carlborg wrote:

Perhaps you already figured this out but template mixins can only mixin declarations, not expression or statements.

--
/Jacob Carlborg

Damn! Yup, first sentence of the documentation. Wishful reading.

Thanks.
Steve

You can of course mixin a function (either nested inside the constructor or as a member or even a free funtion) containing whatever you want and then call that.

That won't help you with calling super() though, you can only call super from another constructor. You'd have to use a string mixin as that truly can inject arbitrary code.

This opens a question:

Should functions nested in constructors be given all the same powers that a constructor has (calling super, initializing const/immutable data etc)?

Reply via email to