Great questions, thanks!
TBH I didn’t. This simple exs was a first thing that came to mind
But now that you mention it, if we think about larger projects where developers want to be fine grained and so create a larger number of boundaries, I think that a decentralized approach would definitely scale better than a single .exs file which would possibly become bloated.
I guess a big unknown for me at this point is do we expect such fine granularity? I’d typically expect a much smaller amount of boundaries compared to the number of modules. And if I’m right, then perhaps a centralized solution might be simpler.
OTOH, I do have some ideas to support sub-boundaries (internal boundaries within boundaries), and for that approach, I think that decentralized definitely seems like a better option.
Another win for decentralized is that you don’t need to sync another file. So for example, if you delete or rename a module, the boundary info is auto updated.
One small issue with decentralized is that a root module always has to exist. So if I don’t have a root module, I need to create it for the sole purpose of having a boundary. Perhaps that’s fine.
Also, the usage would then probably look like:
defmodule MyBoundary do
Which, under the hood would be persisted to BEAM, so they can be collected by the boundaries checker.
I’m a bit unhappy about using
use, but ATM I don’t see a simple solution which isn’t built on use.
No, but that’s an interesting idea, thanks! I’ll keep it in mind.
Absolutely agree! I advertise it as an alternative to umbrella for specifying and enforcing boundaries. Nothing more than that
In theory, it already works (compiler is marked as recursive). In practice, I have no idea because I haven’t tested it If boundaries in umbrella projects don’t work, open up an issue on the repo.
Currently no, but you make good argument why this might make sense.