On Thursday, 10 September 2015 at 08:22:29 UTC, Daniel N wrote:
this(string caller = __MODULE__)(int val) if(caller == "std.conv") // Use scoped!Awesome

That's disgustingly.... genius. I'm a bit jealous I didn't think of it myself!

One slight problem though: you couldn't call super() from a derived class, since the constructor wouldn't even exist due to the constraint.

You could just put the hard work in a protected helper function though and then child classes call it instead of the super ctor.... then you could do a mixin template that forwards to that to kinda automate this ctor too.

this is fairly usable!

Reply via email to