|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2006-11-29 19:56:57
Maarten Kronenburg wrote:
> "Herve Bronnimann" wrote in message
>> I've heard this often enough since the beginning of this discussion, and
> imho it's a major source of confusion and problems in the design. Google
> "Liskov Substitution Principle", "ISA Relationship" or other similar
> keywords, for more information. The famous example is
> Shape/Rectangle/Square (read
> http://www.objectmentor.com/resources/articles/lsp.pdf for a good
> discussion).
>> So I have to say this loud and clear: a natural number <NOT> "is a" </NOT>
> integer. It is not, no more than a modular one is. Try subtracting 1 to 0,
> and you will not get the same behavior in either three types. This violates
> the LSP (Liskov Subst. Princ. mentioned above)
>
> For determining whether an arithmetic result is positive or negative, you
> have to compute it first, and for determining whether a modular integer
> arithmetic result needs to be modulo reduced, you need to know the result
> first, which may not be in the modulo range. For this practical reason the
> unsigned and modular integer are built up from a normal integer. Software
> design is (in this case) a little more practical than pure mathematics,
> where an unsigned integer is always by definition positive and a modulo
> integer is always by definition in the modulo range. The ideal mathematical
> world can (in this case) not be achieved by real software, but only
> approached.
> Regards, Maarten.
Ok, I've been way too busy to pay attention to this thread carefully, but I
have to say what parts I've read are mostly about several folks objecting to
this design -- again. We've had this long discussion once before in May/June
of this year. I believe the first objection to the polymorphic design began here:
http://lists.boost.org/Archives/boost/2006/05/105372.php
The discussion goes on for a long time. Here's some selected bites:
http://lists.boost.org/Archives/boost/2006/06/105822.php
http://lists.boost.org/Archives/boost/2006/06/105677.php
http://lists.boost.org/Archives/boost/2006/06/105660.php
Finally it culminated in this post from me that got no reply.
http://lists.boost.org/Archives/boost/2006/06/105744.php
Many on this list obviously disagree with the choice of runtime polymorphism.
I personally think the unsigned type should be dropped and all the runtime
polymorphism removed as was suggested back in June.
This level of objection among the Boost community does not bode well for this
proposal in the standard committee. Some of the people objecting are voting
members of that committee. But, in the end, it's up to Maarten to decide how
he wants to proceed with the design -- it's his work. At this point, however,
I'm happy to see an alternative effort because I don't think Maarten is going
to change his mind. And I feel certain that this library won't make it into
Boost or the standard.
Note that besides Daryle's new effort, which I haven't looked at, there's
Boost BigInt by Ron Garcia and friends in the sandbox as well. Not sure why
we keep reinventing this but never finishing...
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk