std.string import cleanup: how to fix regression?

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 13 00:15:10 PST 2014


On Wednesday, 12 November 2014 at 17:27:18 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> Recently, Ilya has been helping to clean up import dependencies 
> between
> Phobos module. In the course of cleaning up std.string, a few 
> public
> imports were removed because they were not referenced by the 
> module
> itself. However, this caused a regression:
>
> https://issues.dlang.org/show_bug.cgi?id=13717
>
> The code that got removed was:
>
> ------
> //Remove when repeat is finally removed. They're only here as 
> part of the
> //deprecation of these functions in std.string.
> public import std.algorithm : startsWith, endsWith, cmp, count;
> public import std.array : join, split;
> ------
>
>>From the comment, it seems clear that the intent is to move 
>>these
> functions out of std.string into std.algorithm and std.array. 
> However,
> there is currently no way to deprecate public imports, so we 
> can't get
> rid of this dependency without breaking user code (one of my 
> projects
> already doesn't compile because of this).
>
> What should we do? Anybody has a good idea for getting rid of 
> the
> gratuitous dependency on std.algorithm / std.array without 
> breaking user
> code with no warning?
>
>
> T

What about:

static import std.algorithm : startsWith, endsWith, cmp, count;
static import std.array : join, split;

deprecated {
     alias startsWith = std.algorithm.startsWith;
     ...
}


More information about the Digitalmars-d mailing list