D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6027 - bigint to!string conversion and its implications
Summary: bigint to!string conversion and its implications
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-18 07:27 UTC by Vladimir Matveev
Modified: 2012-05-19 18:48 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Matveev 2011-05-18 07:27:44 UTC
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 bearophile_hugs 2011-05-18 13:46:37 UTC
See also issue 5970 and issue 5971
Comment 2 Don 2011-05-18 21:10:22 UTC
(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 Kenji Hara 2012-05-19 18:48:34 UTC
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.