I think everyone agrees configuration can be improved but a solution to this problem is not trivial. In particular, you have to remember Elixir that compile time in Elixir is runtime. So there are libraries with only runtime configuration but they can become compile-time configuration once the library is used at compile-time. This is mostly a conceptual issue, I don't recall seeing it in practice, but it is a very important aspect.
This means that: 1. Comparisons with Erlang is not enough because Erlang does not have the compile/runtime duality (it does but it is restricted to parse_transforms, which are generally discouraged) 2. The sys.config approach is basically what config providers will provide out of the box 3. Honestly, the fact compile time configuration "pollutes" sys.config is on all purposes irrelevant. What are we aiming to save? Some bytes? Most tools abstract over sys.config anyway and Elixir has to do abstract over it as well otherwise Elixir developers have to configure everything using Erlang terms. To me, the real issue with compile-time configuration is understanding that changing a compile-time configuration inside a release won't have any effect. It is important to state the problem well because it will help design the solution. I think having some sort of "compilation?" flag does not solve the problem because it pushes concerns to users, as they now have to figure out what goes where, but it doesn't solve you accidentally putting something compile time mixed with runtime. I think the issue should be pushed to libraries authors, not library users. There have been longer discussions on the topic, especially on ElixirForum, but this is a good digest. :) *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Sat, Mar 30, 2019 at 10:24 AM Łukasz Niemier <[email protected]> wrote: > Current state of configuration in Elixir is a little bit problematic. > There is idea for adding config providers directly to core, but IMHO the > Erlang's approach with sys.config isn't that bad when you get a little bit > used to it. So my problem is that right now some Elixir libraries "pollute" > that file with compile-time only values (most important violators are > Phoenix.Endpoint and mime application). What would be useful to either have > a way to determine in `config/config.exs` whether it is compilation step or > runtime, or to provide separate file with configuration-only values. The > first option seems to be much more flexible as we can easily achieve that > by using `if compilation?, do: import_config("compile-time.exs")`. > > What are your opinions on this? > > -- > 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/1cf235fa-67fb-4d85-875f-6d7c02d4d4ec%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/1cf235fa-67fb-4d85-875f-6d7c02d4d4ec%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAGnRm4Kk%3DhbMPoBDoQATS8tzLTyEUKo0tzPJWMLs-PLV-BhCMQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
