Hipreme's #4 Tip of the day - Don't use package.d

Steven Schveighoffer schveiguy at gmail.com
Fri Nov 4 20:39:14 UTC 2022


On 11/4/22 3:49 PM, Adam D Ruppe wrote:
> On Friday, 4 November 2022 at 19:34:58 UTC, jmh530 wrote:
>> Oh really, then what's the point of package.d?
> 
> It was originally added because Phobos had `std.algorithm` and 
> `std.datetime` and some people wanted to break them up into pieces, but 
> not break user code that still said `import std.algorithm` instead of 
> `import std.algorithm.sorting` (or whatever).
> 
> One alternative was to call the new things like 
> `std.algorithm_parts.sorted` but this name a little ugly and people 
> would be less likely to transition to it.

It still didn't work. I almost always just do `import std.algorithm;`. 
Not worth my time to look up which specific algorithm submodule has the 
thing I need, especially when most likely std.algorithm.foo is going to 
import std.algorithm.bar anyway.

-Steve


More information about the Digitalmars-d-learn mailing list