On Sunday, 3 December 2017 at 14:58:03 UTC, Basile B. wrote:
In this case i'd go for a typed pointer, e.g

---
immutable struct Configuration
{
    this(string){/*load some file...*/}
    int value;
}

Configuration* config;

void main()
{
    try config = new Configuration("config.sdl");
    catch(Exception){}
    // config.value = 42; // ok, read only
}
---

When config is null, e.g. in case "load some file..." threw, you get a segfault. No error handling at all!

Reply via email to