Best way to pass nested options to `use Module`


when we pass options to use Module we usually do that via a list. Most of the time the options are simple and don’t require any nesting.

In my case, I need nested options. What is the best way to accept them?
My first guess is simply a nested list. Something like:

  use Module,
      scope_1: [opt_1: :value, opt_2: :value],
      scope_2: [opt_1: :value, opt_2: :value]

Is that fine or should I use something else? From a usage point of view, this is already quite comfortable since I can just use Keyword.get and define default values.

I always find accepting a keyword list and building a map of of it internally to be a good default to handle config.


What are you then doing with that scopes? Because maybe you do not need any keyword to map conversion.

Actually, I decided to build it in the way that the scoped options get passed to another use SecondModule which then has a normal keyword list without nesting.