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

Re: Views on changing Math-BigInt OO design

Thread Previous
October 7, 2015 23:37
Re: Views on changing Math-BigInt OO design
Message ID:
Peter John Acklam wrote:
> (Pardon me if it is considered bad form to bring up an old discussion,
> but I would like to keep this discussion in one place.)
> I realized that converting Math::BigInt into a subclass will make it
> impossible to use the following non-OO syntax, which is still supported:
>   $ perl -MMath::BigInt -wle 'print Math::BigInt::badd(3, 5)'
>   8
> Even my soon 20 year old version of The Camel Book does not mention this
> syntax, so I doubt it is much used anymore, but there could stille be
> some old code that will break if this syntax no longer works.
> Way back one could also use
>   $ perl -MMath::BigFloat -wle 'print Math::BigFloat::fadd(3, 5)'
>   +8E+0
> but this non-OO syntax was no longer possible when Tels' re-written
> version of the Math-BigInt distribution was merged into core Perl with
> the commit 58cde26e9566cfa700a6d18945c4428f22c6be85 from Jun 16 2001.
> In essence, if I go on with my idea, Math::BigInt::badd(3, 5) will have
> to be written as Math::BigInt -> badd(3, 5). Is that such a big problem
> that I should leave the code as it is?
> Peter

I am not addressing Math::* specifically, but plain sub calls are 
faster/less complicated than method calls which use @ISA/method 
cache/other APIs/etc. Unless you know why you are using OOP, and your 
downstream code actually uses OOP-ness (abstract base class), dont use 
OOP or convert functional code to OOP for the sake for religious purity.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About