mathieuprog / polymorphic_embed

Polymorphic embeds in Ecto
Apache License 2.0
340 stars 62 forks source link

Compile time dependencies between embedded schemas #85

Closed crbelaus closed 6 months ago

crbelaus commented 1 year ago

When using polymorphic_embeds_one and polymorphic_embeds_many this library creates compile time dependencies between the parent module and the polymorphic embed modules. This causes huge dependency graphs in which changing a file requires a recompilation of many others.

This same problem existed in Ecto some time ago as reported in elixir-ecto/ecto#1610. The Ecto team fixed this by disabling the lexical tracker for the association modules as shown in elixir-ecto/ecto#1670.

Given that Polymorphic Embed aims to mimic Ecto's embeds_one and embeds_many. Would it make sense to use the same approach as Ecto did to fix this issue?