[Issue 5231] BigInt lacks a normal toString()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 18 12:32:53 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5231



--- Comment #12 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-11-18 12:31:36 PST ---
So, you don't want writeln(bi); or to!string(bi) to work? I would think that
ideally, BigInt would work exactly the same way that integers do.

to!string(i) -> decimal
writeln(i) -> decimal
writefln("%s", i) -> decimal
writefln("%d", i) -> decimal
writefln("%f", i) -> hex


So, ideally, BigInt would do the same:

to!string(bi) -> decimal
writeln(bi) -> decimal
writefln("%s", bi) -> decimal
writefln("%d", bi) -> decimal
writefln("%f", bi) -> hex


But you only want this?:

writefln("%d", bi) -> decimal
writefln("%f", bi) -> hex


Okay. I can see an argument for a better handling of toString() in general (I'd
never even heard anyone complain about string toString() or discuss the
possibility of a void toString() before the discussion on this bug report) and
that to!string(), writeln(), writefln(), etc. need to be fixed to support a
void toString() instead of string toString(), but I don't understand why you
would refuse to allow for BigInt to be convertible to a string or printed as
one without a format string. I don't see why it shouldn't act the same way that
all of the built-in integral values do in this regard.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list