Suggestion for DUB users: The vanity package
Steven Schveighoffer
schveiguy at gmail.com
Wed Oct 20 13:39:22 UTC 2021
On 10/19/21 3:31 PM, Paul Backus wrote:
> On Tuesday, 19 October 2021 at 16:37:00 UTC, Kagamin wrote:
>> If we can have several libraries starting with com and org, why not
>> have a default package `d` or `dlang` used by everyone, so it would be
>> module d.bitblob;
>
> Then you have to get everyone using that package to agree not to create
> naming conflicts. E.g., if I decide to publish `d.foo`, nobody else is
> allowed to publish their own `d.foo`.
How is this different from today where your no-package module can be
named whatever you want? Seems like a separate problem.
> But if you are capable of doing that, then you don't need the package at
> all: you can just get everybody to agree to avoid naming conflicts at
> the top level.
Naming conflicts with *other package names* is not the problem. It's the
fact that the no-package module conflicts with anything else in your
namespace, including imports from other modules.
e.g. try to name a function `std`, then import `std.stdio`. You will get
a failure.
Whereas if you name your function `stdio`, then everything works fine.
Note that I didn't think before about `com` and `org`, those can be
reasonable names. My codebase has a lot of `org` variables, as I'm
dealing with organizations in a database.
-Steve
More information about the Digitalmars-d
mailing list