Best practice for dub registry package and module names
Adam D Ruppe
destructionator at gmail.com
Sun Sep 4 12:00:21 UTC 2022
On Sunday, 4 September 2022 at 01:52:11 UTC, Ali Çehreli wrote:
> Should the package be the author's name: acehreli.a,
> acehreli.b, and acehreli.c?
This is what I'd suggest. You want something that nobody else is
likely to step on throughout the entirety of the D ecosystem. It
doesn't have to literally be your name, but it should be
something unique and probably arbitrary at the top level. This
way you can use it as much as you want without worrying about
conflicting with someone else.
Then you have the more descriptive name as the module.
Your dub package name is then a combination of these to make that
unique too. So you might have dub package `acehreli-a` which has
the D module `acehreli.a`.
> What about module names? If the type is 'struct MyCache',
> should the module name be mycache, or my_cache, or my-cache?
Module names must be valid D identifiers, so no dash there.
Whether you use _ or squeeze the words together is up to you, I'd
say pick whichever one is easier to read.
I usually squeeze words together.
More information about the Digitalmars-d-learn