On Thursday, 29 October 2020 at 16:45:51 UTC, Ali Çehreli wrote:
immutable string p; shared static this() { p = environment["PATH"]; // <-- Run time }
Immutable static variables being implicitly non-thread-local is a design mistake. Thread-local immutable variables have the same right to exist as immutable class/struct instance fields.
This should be possible without hacks: immutable int val; // thread-specific value static this() { val = ...; } ...because it is logically the same as: struct V { immutable int val; } V val; static this() { val = V(...); }