It has been proposed various times.

Checkout https://github.com/elixir-lang/elixir/pull/7172

On Tuesday, 18 December 2018 17:09:12 UTC+1, thia.md...@gmail.com wrote:
>
> 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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/25cd11a2-d9f6-4f28-841c-baca3af2f948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to