The subject says it all really. i have this example:

import core.memory;

class fruit{
  int value=5;
  public int getvalue(){
    return value;
  }
}

int main(string[] args) {
    GC.disable;
    static fruit myfruit;
    return myfruit.getvalue();
}

Most of the smart people will see that i want the program to return 5 but I did something dumb and didn't put in the "new" statement?

So my question is in longer words "Can I create instances of objects at compile time?" and if not "why not, i could build something (roughly)equivalent out of structs and functions and have it at compile time?"

Reply via email to