Best practice for dub registry package and module names
madric at gmail.com
Wed Sep 7 06:12:58 UTC 2022
On Sunday, 4 September 2022 at 01:52:11 UTC, Ali Çehreli wrote:
> Let's say I have three modules that work together, which I want
> to register on dub: A, B, and C.
Here I would take inspiration from the Java world, where a
"domain" is used per project. Typically this domain is written
from the most general part of the domain to the most specific, so
"web.example.com" becomes "com.example.web".
So you could have: com.alicorp.a, com.alicorp.b, and com.alicorp.c
That being said, D is not Java, thus things like the company
top-level domain could be left out and you end up with alicorp.a,
Thus the problem of name collision goes away until someone else
tries to take the name "alicorp". I believe this is why Java uses
the full domain, because unique domain ownership is already a
solved problem, they just ride along.
Packages like `vibe` follow a similar mechanism, where all the
useful modules and packages are nested under a single package.
More information about the Digitalmars-d-learn