Bug 18048 – std.bigint.toDecimalString is impure

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-08T17:49:20Z
Last change time
2018-01-02T19:01:37Z
Assigned to
Jack Stouffer
Creator
Jack Stouffer

Comments

Comment #0 by jack — 2017-12-08T17:49:20Z
Looking at the code, there's no reason why to decimal string needs to be impure, it's just that the `toString` of BigInt uses the delegate sink method of `toString`, which must necessarily be impure, while the underlying function which actually calculates the string is pure. toDecimalString should be reworked to be pure
Comment #1 by simen.kjaras — 2017-12-08T22:26:08Z
Comment #2 by github-bugzilla — 2017-12-10T16:40:41Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f01efe3618a8d72e08d013c605537835901edae5 Merge pull request #5913 from Biotronic/Issue18048 Fixed 18048 std.bigint.toDecimalString is impure merged-on-behalf-of: Jack Stouffer <[email protected]>
Comment #3 by github-bugzilla — 2017-12-18T22:57:36Z
Commit pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f01efe3618a8d72e08d013c605537835901edae5 Merge pull request #5913 from Biotronic/Issue18048