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

Fri Jul 25 10:29:51 CEST 2014

> On Thu, Jul 24, 2014 at 9:05 AM, Max Treskin <zerthurd@REDACTED> asked
how to use "any term" as a key in application:set_env &c.

My proposal of many years for 'frames' restricted keys to atoms.
I still think that *as a replacement for records*, that's the
optimal design decision.  But what Erlang actually *has* these
days is 'maps'.  And those things accept any term as a key.

So why not have 'extra' as a single application key with the
value of that key being a map?  To set what you want, you'd
have to get the old map (with #{} as the default), set/replace
the subkey you have in mind, and then put the whole map back.

More information about the erlang-questions mailing list