That's a fantastic answer! Thank you. I was not aware that
initializers were always compile time, that was the missing piece
in my understanding.
It's a shame that I can't use the nicer (IMO) syntax, but the
reasoning is sound.
Consider the following:
class A
{
int x;
}
class B
{
A a = new A; // I would expect this to be called for each
"new B".
}
void main()
{
import std.stdio;
auto c = new B;
writeln("c ", c.a.x);
c.a.x++;
writeln("c ", c.a.x);
writeln;
auto d = new B;
I'm not sure if "Template Oriented Programming" seems to be the
way to go in D, but I've got my head mainly stuck around OOP.
I'm a bit confused about how to dive into it.
With OOP, we create interfaces, which provide a contract that all
implementers of the interface have to abide by.