3 ms·
Exactly. Setting environment variables while a program is running is a terrible idea. Thread safe or not. A lot of code, for good reasons, assume envvars are c
by Too 3y ago
Exactly. Setting environment variables while a program is running is a terrible idea. Thread safe or not.
A lot of code, for good reasons, assume envvars are constants set before the program started and caches computations based on them, read config files and so on.
The fact that they are essentially global variables should be enough to deter usage of them.
- chriswarbo 3y ago> The fact that they are essentially global variables should be enough to deter usage of them Env var behaviour is much closer to dynamic variables, rather than global variables (which I argue at http://www.chriswarbo.net/blog/2021-04-08-env_vars.html http://www.chriswarbo.net/blog/2021-04-08-env_vars.html ) Either way, I agree that mutating them is usually a bad idea; though I find them very good for constant (or dynamically-bound) config.