Hi,

Would be great if we had in the System module functions similar to those 
that we have right now in the Application module.

`System.get_env/2` could accept a default value similar to 
`Application.get_env/3`. I always find myself using System.get_env("VAR") 
|| "DEFAULT VALUE".

And we could have `System.fetch_env/1` and `System.fetch_env!/1`. The 
fetch_env!/1 I would use a lot. Normally you want to raise an error if the 
variable does not exists and would be great if the already existed an 
function to do that. Right we have to use Map.fetch! 
`Map.fetch!(System.get_env(), "VAR")` or create our own custom function 
that raises an error. I think that as it is a common use case would make 
sense to include this functions in the language.

What do you guys think?

Thanks,
Thiago

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/fad4a026-f04b-474a-8ead-d8d9fbeee3f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to