[Issue 5231] BigInt lacks a normal toString()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 18 05:11:43 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5231
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #6 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-11-18 05:10:23 PST ---
(In reply to comment #2)
> That's not really the correct solution.
> BigInt should act like an int. Specifically,
>
> BigInt b;
> writefln(" b = %d, %x", b, b);
> should just work.
>
> This issue cannot be resolved until the definition of toString() is changed.
> void toString() is a fundamentally broken design. It's wrong on many levels.
So BigInt's aren't printable via writeln in protest? I guess I don't
understand why you can't do this:
string toString()
{
string retval;
void sink(const(char)[] data) { retval ~= data; }
toString(&sink, null);
return retval;
}
It doesn't hurt/limit the current toString, does it? And then it makes bigints
printable via writeln.
BTW, toString's delegate is not scope, so you are going to allocate a closure
for that...
--
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