Keyword "package" prevents from importing a package module "package.d"
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Thu Nov 2 19:30:58 UTC 2023
On Thursday, November 2, 2023 7:04:37 AM MDT Adam D Ruppe via Digitalmars-d-
learn wrote:
> On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote:
> > Therefore the need to import `package.d` is needed and I can't
> > see a solution, which means
>
> tbh package.d should never be used. It is a poorly designed,
> buggy misfeature of the language with plenty of better working
> alternatives (it is no different than making a `module
> yourthing.all;` people can import execpt with more limitations
> and bugs.)
The entire reason that it was added to the language was to be able to split
up existing modules without breaking code. And it does that well. It was
never intended to be used for anything else, but of course, some people
always find ways to misuse a feature.
package.d is indeed completely unnecessary for creating a module that
publicly imports other modules in order to be able to import a single module
and get several modules. Either way, personally, I don't think that that's
something that should typically be done (with package.d or with any module
name), but for whatever reason, some folks seem to love the idea.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list