From:

Date:

July 28, 2015 08:39Subject:

Views on changing Math-BigInt OO designMessage ID:

CAEvoY4178u58D5Tmw57aFhP31G3DeknLucsBmJjLbnNcfBuGAQ@mail.gmail.comI want to change the OO design of the Math-BigInt distribution, but before I do so, I would like your opinion. Current implementation: Currently, Math::BigInt is the superclass of Math::BigFloat, which in turn is the superclass of Math::BigRat. This OO design doesn't make sense. None of Math::BigInt, Math::BigFloat, and Math::BigRat have an internal structure which is a superset/subset of any of the others. Methods like band(), bor() etc. make sense on Math::BigInt objects, but don't make sense on Math::BigFloat objects and Math::BigRat objects, who inherits the methods band(), bor() etc. TELS, who introduced this design, seemed to be aware of the problems, and as a sort of workaround let Math::BigFloat->isa("Math::BigInt") return false. Ditto for Math::BigRat. This doesn't solve the real problems and causes problems (e.g., endless recursion) when creating subclasses. New implementation: I want to introduce Math::BigNum as a virtual parent class, and let Math::BigInt, Math::BigFloat, and Math::BigRat be subclasses of Math::BigNum. Math::BigNum will implement the very few methods that Math::BigInt, Math::BigFloat, and Math::BigRat have in common as well as some internal utility functions. Would this be OK? Regards, Peter John Acklam (current maintainer of Math-BigInt, Math-BigRat, and bignum)Thread Next

**Views on changing Math-BigInt OO design**by Peter John Acklam- Re: Views on changing Math-BigInt OO design by Zefram
- Re: Views on changing Math-BigInt OO design by Shlomi Fish
- Re: Views on changing Math-BigInt OO design by James E Keenan
- Re: Views on changing Math-BigInt OO design by Peter John Acklam
- Re: Views on changing Math-BigInt OO design by Abigail
- Re: Views on changing Math-BigInt OO design by David Bundgaard
- Re: Views on changing Math-BigInt OO design by Abigail
- Re: Views on changing Math-BigInt OO design by Peter John Acklam
- Re: Views on changing Math-BigInt OO design by Aristotle Pagaltzis
- Re: Views on changing Math-BigInt OO design by John Peacock
- Re: Views on changing Math-BigInt OO design by Peter John Acklam
- Re: Views on changing Math-BigInt OO design by Aristotle Pagaltzis
- Re: Views on changing Math-BigInt OO design by bulk88

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About