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
(In reply to Jacob Carlborg from comment #0) > The commit that introduced the regression seems to be: > 8b361fb217f87ac32c8904fb520cd301d2bc327a. (In reply to Martin Nowak from comment #2) > 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. My bisection result is pointing at neither of these, but rather at https://github.com/D-Programming-Language/phobos/pull/2717
Comment #7 by code — 2015-03-15T16:57:06Z
I agree with Ketmar here, we should simply add it to std.string. It's bad enough that one has to import even a single module to perform basic string operations. https://github.com/D-Programming-Language/phobos/pull/3055
Comment #8 by github-bugzilla — 2015-03-15T19:29:39Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/e5eea9af43aa6836a3bfd48cc02706facb60dae8 fix Issue 14197 - replace was removed from std.string - add public aliases to std.array.replace/replaceInPlace - std.string should at least cover any basic string manipulation needs https://github.com/D-Programming-Language/phobos/commit/e15c5a260a0e3907e7d4606b4da9fde7d1d910eb Merge pull request #3055 from MartinNowak/fix14197 fix Issue 14197 - replace was removed from std.string
Comment #9 by github-bugzilla — 2015-03-15T21:05:12Z
Commit pushed to 2.067 at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/9350b01825157f210edc9139c6e1c5c7e985a894 Merge pull request #3055 from MartinNowak/fix14197 fix Issue 14197 - replace was removed from std.string Conflicts: std/string.d
Comment #10 by github-bugzilla — 2015-04-11T12:25:04Z
Comment #11 by github-bugzilla — 2017-07-19T17:42:36Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e5eea9af43aa6836a3bfd48cc02706facb60dae8 fix Issue 14197 - replace was removed from std.string https://github.com/dlang/phobos/commit/e15c5a260a0e3907e7d4606b4da9fde7d1d910eb Merge pull request #3055 from MartinNowak/fix14197