[phobos] BigInt from Tango

Don Clugston dclugston at googlemail.com
Thu Mar 18 20:46:52 PDT 2010


I've converted my BigInt module from Tango to Phobos2. It's a great
test of the new operator overloading!
After 2.042 comes out, I'd like to add it to Phobos.

A couple of issues:
(1) We need somewhere in Phobos for implementation code (of which
there is a considerable amount for BigInt).

I propose std.internal.math.XXX; for all math related modules. This
would keep everything tidy and hidden.
None of this will be user-visible.

(2)  Syntax for conversion to string is undecided. Strawman:

 void toString(void delegate(const(char)[]) sink, string format);

where format is currently limited to:

d    for decimal
x    for lower case hex
X    for upper case hex

but will be extended in the future. If format is "", defaults to decimal.
Sink takes a const(char)[] so that BigInt can keep reusing the same buffer.

Eventually, whatever is chosen will require some changes to
std.format, but I'd just like to get a reasonable first cut for the
initial release.


More information about the phobos mailing list