Thank you.

I understand it as functiosn, but not classes, i fixed it by moving creating "env" from declaration of the "SardRun" class into a function.

https://github.com/zaher/d-sard/commit/9fbf3df40373d89152b00c02d9de352d64c12077#diff-8b265cbc4eda6c1f724e9f726b0da853

I feel i will fail in the same error in the future, i want to understand it


On Friday, 26 December 2014 at 08:55:36 UTC, Tobias Pankrath wrote:
---
class C
{
     int a = foo(); // foo is called at compile time
}
---

Reduced test case:

---
class S
{
    int a = compileTime(1);
    int b = compileTime(2);
}

int compileTime(int i) { import std.stdio; writeln("ct"); return
i; }
---

This works as expected. To initialize your fields at runtime
(using a constructor) will solve your problem.

Reply via email to