Bug 12817 – pure nothrow text(BigInt) too

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-05-28T22:45:49Z
Last change time
2024-12-01T16:21:19Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: phobos#10058 →

Comments

Comment #0 by bearophile_hugs — 2014-05-28T22:45:49Z
In dmd 2.066alpha this compiles and runs: void main() pure nothrow { import std.conv: text; int x = 10; assert(text(x) == "10"); } While thios: void main() pure nothrow { import std.bigint: BigInt; import std.conv: text; BigInt x = 10; assert(text(x) == "10"); } temp.d(5,16): Error: pure function 'D main' cannot call impure function 'std.conv.text!(BigInt).text' temp.d(5,16): Error: 'std.conv.text!(BigInt).text' is not nothrow temp.d(1,6): Error: function 'D main' is nothrow yet may throw
Comment #1 by safety0ff.bugz — 2014-05-28T22:56:33Z
Fixing #6007 may involve a solution which isn't strictly pure (global cache of powers of the base we're converting to.) This is the solution OpenJDK's biginteger class uses, whether or not we use a global cache or recompute the powers each time is a design issue for the person who decides to fix #6007. Anyways, I think we should not be so eager in adding pure to the conversion to string unless we have a "trusted pure" available.
Comment #2 by robert.schadek — 2024-12-01T16:21:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10058 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB