TSa wrote:
My list was sorted in decreasing order of importance with the
F-definition beating the E-definition in popularity. So all I want is
use Math::DivMod:euclid;
to get the E-definition and a
use Math::DivMod;
to get them all. The F-definition being the default when no import is
done.
You're unlikely to ever need more than one definition at a time; so
put each in its own module and import as needed. This will produce
both simpler code (you won't need to remember which of nearly a
half-dozen variant spellings of div or mod to use each time in order
to get the appropriate definition) and more readable code (e.g., if
you see "use Math::Modulus::Truncate" in a given lexical scope, you
know that div and mod will be using the truncating definition there).
In the rare instance that you need more than one definition at a time,
import the ones you need and qualify your div and mod calls by the
module names: e.g. 'Math::Modulus::Euclid::div' and
'Math::Modulus::Floor::div'. The Huffman coding seems appropriate;
and if the length is excessive, it's because the module names' lengths
should be shorter (say, 'Math::ModE' instead of
'Math::Modulus::Euclid').
A sane definition of div and % is important. A spec that leaves
it up to the implementation to pick whatever is convenient is bad in
my eyes.
Agreed. My only doubt at this point is which definition should be the
default. Do we go with "mathematically elegant" (E) or "industry
standard" (F, I think)?
--
Jonathan "Dataweaver" Lang