Stopping compile time execution

Russel Winder russel at
Fri May 25 15:58:55 UTC 2018

I have a bit of code which is the definition of a class Preferences,
which has:

	this() {
		filePath = expandTilde(chainPath("~", ".config", "me-tv", "preferences.yml").array);

filePath is a member of the class. Now if I have a module level
instance (clearly not a good move but OK for now):

   public auto preferences = new Preferences;

then Dub using DMD on Debian Sid gives me:

/usr/include/dmd/phobos/std/path.d(3970,31): Error: getenv cannot be interpreted at compile time, because it has no available source code
/usr/include/dmd/phobos/std/path.d(4064,41):        called from here: expandFromEnvironment(inputPath)
source/preferences.d(36,25):        called from here: expandTilde(array(chainPath("~", ".config", "me-tv", "preferences.yml")))

What is the official way of getting preferences initialised at run time
and not compile time.

Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Digitalmars-d-learn mailing list