Th. J. van Hoesel th.j.v.hoesel at
Thu May 2 23:50:14 BST 2013

That sounds like nasty programming

it does catch for zero arguments, returning a default Fraction object, it does catch for 1 argument, making a difference for a reference to a Fraction or a string num/den... so why not complain for a bad methode call the moment it's more than two arguments

It doesn't make sense to call a function like 'sin (30 , 45, 270)'

Aditional parameters do not make sense.


If that is so called 'best practice'... who am I to judge as a novice baby-Perl monk


Verstuurd vanaf mijn iPhone

Op 2 mei 2013 om 23:44 heeft James Laver <james.laver at> het volgende geschreven:

> On 2 May 2013, at 18:50, "Th. J. van Hoesel" <th.j.v.hoesel at> wrote:
>> Back to your code, line 198:
>> if (@_ >= 2)
>> Why not check for 
>> if (@_ == 2)
>> ?
>> it should have only two arguments to construct a fraction from calling Number::Fraction->new(1, 2);
>> Why would you allow it to pass other arguments?
> It looks like a combination of defensive programming and laziness. If you check for length of two, you have to handle both the case of too few args and too many args in addition to the case of two args. This is lazier and will it really harm it people pass more than 2 to silently ignore the extras?
> James

More information about the mailing list