Bug 14197 – "replace" was moved from std.string without alias added
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-18T13:17:00Z
Last change time
2017-07-19T17:42:36Z
Keywords
pull
Assigned to
nobody
Creator
doob
Comments
Comment #0 by doob — 2015-02-18T13:17:41Z
The "replace" function was moved from std.string to std.array and no public import or alias was added (as far as I can see) to keep the backward compatibility. Example:
import std.string : replace;
The above code works with DMD 2.066.1 but fails to compile with 2.067.0-b2. The commit that introduced the regression seems to be: 8b361fb217f87ac32c8904fb520cd301d2bc327a.
Comment #1 by doob — 2015-02-18T13:17:59Z
BTW, this breaks DWT.
Comment #2 by code — 2015-02-19T02:00:12Z
That commit is from "Jan 19, 2011" and replace wasn't available through std.string since then.
I think you got hit by our famous import issue 314 and the localization of imports here https://github.com/D-Programming-Language/phobos/pull/2675.
Comment #3 by bugzilla — 2015-02-22T07:48:56Z
(In reply to Jacob Carlborg from comment #1)
> BTW, this breaks DWT.
It's been 4 years since replace was moved to std.array - I'm willing to add an alias to std.string, but would rather DWT was fixed. What do you think?
Comment #4 by doob — 2015-02-22T10:20:10Z
(In reply to Walter Bright from comment #3)
> It's been 4 years since replace was moved to std.array
It doesn't matter. It's between the latest stable version (2.066.1) and the current beta (2.067.0-b2) the problem appeared. As Martin said, it's most likely due to issue 314.
> - I'm willing to add
> an alias to std.string
I think an alias should be added and go through the standard deprecation path. It's not impossible that other projects have the same problem.
> but would rather DWT was fixed. What do you think?
I'm having a really hard time understanding this. On one hand you're suggesting me to fix my code because of a breaking change. On the other hand you're complaining about your old D1 code doesn't compile with the latest D2 compiler [1]. But as always, I will fix my code to be able to continue compiling it and finding more breaking changes [2].
[1] http://forum.dlang.org/post/[email protected]
[2] http://forum.dlang.org/post/[email protected]
Comment #5 by ketmar — 2015-02-22T20:18:46Z
i believe that alias should be added and should *not* be deprecated. i mean, 'cmon, if i want to do a replacement in *string*, i have to import `std.array`? with such changes we improving modularity, but making Phobos (and D, consequently) much harder to use for newcomers.
heck, i still can't remember what i have to import to do some string operations. is it `std.string`? or is it `std.array`? or is it `std.format`? or is it `std.whatever`?
Comment #6 by dlang-bugzilla — 2015-03-04T01:37:47Z