Talk:Arithmetic/Rational

From Rosetta Code
Revision as of 21:53, 13 February 2009 by rosettacode>NevilleDNZ (→‎Too long: now shorter.)

Too long

Gosh, this task seems far too long. I would suggest the task change to be something like the definition of a rational together with the demonstration of its use in computing the addition and subtraction of two rational numbers.

Leave out the class based, and operator overloading to include more languages; and cut down on the definition of operators.

Another, separate task could focus on operator overloading. --Paddy3118 12:58, 13 February 2009 (UTC)

Agreed. This task should simply be about the definition of a rational type and maybe a couple of helper functions (like reduction). There should be no operator definition in this task. That is covered elsewhere. If you still want the operator functionality, then named functions would be preferred so the task isn't restricted to languages with operator definition. --Mwn3d 13:47, 13 February 2009 (UTC)
Actually, if you want the operator functionality, you should simply say "provide a means to do blah," so that languages can use their idiomatic approach, be it operator overloading, function calls, etc. --Short Circuit 16:06, 13 February 2009 (UTC)

I just changed the task definition, and pruned the code and examples back to the minimum required. I suspect that the original code in Python would be really short as python can leverage off duck typing. However ALGOL 68 requires the programmer to MANUALLY define ALL associated assignment operators (e.g. +:=, -:= etc) together with ALL the UPPERCASE equivalent operator, e.g. PLUSAB, MINUSAB etc (to provide portability to wrist watches and main frames). The net effect is an explosion of operator definitions. NevilleDNZ 21:53, 13 February 2009 (UTC)