Bug 6027 – bigint to!string conversion and its implications
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2011-05-18T07:27:00Z
Last change time
2012-05-19T18:48:34Z
Assigned to
nobody
Creator
dpx.infinity
Comments
Comment #0 by dpx.infinity — 2011-05-18T07:27:44Z
I know about issue http://d.puremagic.com/issues/show_bug.cgi?id=5231 , but still the problem exists. It is ok (for me, at least) not to have an ability to use writeln(BigInt(16)). But the design decision not to have string toString() method also affects another parts of the library. There are at least two such places.
First is to!string function. I think that it should work uniformly for all sensible datatypes, and I expect the following equation to work: to!string(123) == to!string(BigInt(123)), because I see no reason against it.
Second is, maybe, an implication of the first. See issue http://d.puremagic.com/issues/show_bug.cgi?id=6023 .
I think this is not a correct situation. There may be reasons why I can't use BigInt-valued random number, but these reasons certainly must not include the inability to do BigInt->string conversion without useless format specifiers.
Comment #1 by bearophile_hugs — 2011-05-18T13:46:37Z
See also issue 5970 and issue 5971
Comment #2 by clugdbug — 2011-05-18T21:10:22Z
(In reply to comment #0)
> I know about issue http://d.puremagic.com/issues/show_bug.cgi?id=5231 , but
> still the problem exists. It is ok (for me, at least) not to have an ability to
> use writeln(BigInt(16)).
That worked in a previous release. It should still work.
Comment #3 by k.hara.pg — 2012-05-19T18:48:34Z
Now to!string(BigInt(123)) works as expected. And bug 6023 is not relevant to toString issue.
If there is other issues still, please reopen.