develooper Front page | perl.perl5.porters | Postings from July 2015

Re: Views on changing Math-BigInt OO design

Thread Previous | Thread Next
From:
Peter John Acklam
Date:
July 28, 2015 11:19
Subject:
Re: Views on changing Math-BigInt OO design
Message ID:
CAEvoY43-MH=2bE3rsTYi0GkQwxLTTFeXZpZ1KFb58Fy+jBO76A@mail.gmail.com
James, that is correct. The user interface would not change at all. I
should have mentioned that in the original posting.

Peter

2015-07-28 13:00 GMT+02:00 James E Keenan <jkeen@verizon.net>:

> On 07/28/2015 04:39 AM, Peter John Acklam wrote:
>
>> I 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?
>>
>>
> This sounds worth exploring.  If I understand you correctly, the end
> user's interface would not change.
>
>
>  Regards,
>> Peter John Acklam
>> (current maintainer of Math-BigInt, Math-BigRat, and bignum)
>>
>>
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About