[erlang-questions] Type spec for application:get_env and set_env

Max Treskin zerthurd@REDACTED
Fri Jul 25 09:48:23 CEST 2014


So what is the best native way to do this? Only to create an additional ETS to keep parameters with an arbitrary term key?

-- 
Max Treskin


From: Steve Vinoski <vinoski@REDACTED>
Reply: Steve Vinoski <vinoski@REDACTED>>
Date: 24 Jul 2014 at 15:50:37
To: Max Treskin <zerthurd@REDACTED>>
Cc: erlang-questions@REDACTED <erlang-questions@REDACTED>>
Subject:  Re: [erlang-questions] Type spec for application:get_env and set_env  




On Thu, Jul 24, 2014 at 9:05 AM, Max Treskin <zerthurd@REDACTED> wrote:
Hello

It is possible to use any term() as a key in application:set_env and then retrieve a value by this term using application:get_env (what is very conveniently), but only atom() is allowed as a key in type spec of these functions.
My proposal is to change type spec in favour of any term usage as a key. Any cons?

I previously brought this up with the OTP team and was reminded that this also affects config files, .app files, and also setting env vars from the command line, with the point being that there could well be unintended side effects of such a change. Some Riak code used to take advantage of what you've described, but after the discussion we modified our code to honor the type spec.

--steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140725/9180ea93/attachment.htm>


More information about the erlang-questions mailing list