Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.XInt formal review
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-03-12 00:21:27


AMDG

On 03/09/2011 12:23 AM, Gordon Woodhull wrote:
>> - What is your evaluation of the design?
> The STL and its offspring are founded on the principle of separating data structures from algorithms. IMO this is important not just so that other representations of big integers could be used, but also for clarity of code.

IMHO, trying to make a bigint "just like the STL"
is simply misguided. Addition, subtraction,
multiplication, and division aren't algorithms
that operate on a bigint. They're the basic
operations that define an integer.

Let's consider why we want to separate
the data structures from the algorithms
again. The basic reason is that this allows
new data structures and new algorithms
to be added independently. Does this apply
here at all? I'm not seeing it:

a) New data structures: The implementation
of the operators depends on the details
of how the numbers are represented. If
you wanted a representation that differed
from what the library provides in any
significant way, you'd have to reimplement
them anyway.
b) New algorithms: Are the basic operations
that are provided not enough for some
algorithm that you care about? Concepts
should be created by abstracting concrete
code. If you try to define the interface by
guessing at what some hypothetical user
might want, you'll end up with something
much more complex than it needs to be.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk