Infinite recursion problem when trying to apply settings pattern to submodules

I’m builting a module which as a number of named submodules, eg.,, etc.
I’d like to try to apply the settings pattern to the options of those sub modules, eg. = defaultSettings in my config = {...} block.

However, since the names of the submodules are only known at eval time, I cannot easily assign the defaults or rather, doing so means iterating over services.myService and re-assigning to it, causing an infinite recursion.

Does anyone have any advice on how to tackle this specific problem?

@Infinisil hope you don’t mind, but as the father of the settings pattern, I’m shamelessly tagging you on this one :smile: