weavejester/integrant

Refset not initialized when loading only subset of keys

solatis opened this issue · 2 comments

It appears that #ig/refset references are not initialized when this is the only place the keys are referenced, and you're loading only a subset of the system.

This makes sense: integrant lazily initialized derived keywords, and when the refset is first encountered, there are no derived keywords yet.

Are there any known workarounds for this?

This is deliberate behaviour. A ref will fail if the reference cannot be found, whereas a refset does not.

This allows you to define broad rules, such as "all keys deriving from ::foo must be initialized before keys deriving from ::bar", without requiring all keys from ::bar to always be initialized.

To get around it, you'll need to include all the keys you want manually. So if you wanted all keys derived from ::foo and ::bar, you'd use a vector [::foo ::bar].

Thanks for the explanation, that makes sense. Closing issue.