[Issue 5231] BigInt lacks a normal toString()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 18 10:21:28 PST 2010


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



--- Comment #10 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-11-18 10:20:08 PST ---
(In reply to comment #9)
> 
> If it was just a question of inefficiency, I would have implemented it. The
> issue is that it doesn't get the formatting string.
> So
> BigInt b;
> writefln("%x %+d", b, b);
> 
> doesn't work, and cannot be made to work.

But what about writeln, or writefln("%s"...) ?  Should those usages be excluded
because you can't have custom formatting?

> No. The format string is absolutely fundamental to the implementation of
> outputting BigInt and BigFloat. It's not just "a crap implementation".

I disagree here.  The huge problem I have with toString is the requirement for
allocating immutable data that immediately gets thrown away.  Supporting custom
formatting is a nice feature but not having it does not severely impact users
nearly as much as not having any output.  In other words, if I want to print a
BigInt in hex, and I get "BigInt", that is useless to me.  If I get it in
decimal, well at least I got something that can be used.

If the format string is so fundamental, then why does BigInt.toString support a
null format argument?

-- 
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