On Fri, Jul 10, 2009 at 3:32 PM, Mark J. Reed <markjr...@gmail.com> wrote:


> The clash between 'log' for 'logarithm' and 'log' for 'write to log
> file' is unfortunate, but since you have to define logging parameters
> somewhere anyway, I'm OK with having to call that sort of log as a
> method on a logger object instead of as a top-level sub.


It none-the-less leaves ambiguity. I think the right way to attack it is to
have  log() be an un-imported-by-default alias for the automatically
imported function in both logging and math modules. Thus someone who is just
too attached to log() can have it, but everyone else can get by with the
imported-by-default name.

So, for example:

logbase($x,$base) = log in the given base, no default
log10($x) = logbase($x,10), log in base 10
logn($x) = logbase($x,$Math::e), log in base e
log($x) = unexported logbase($x,$base=$Math::e), log in base e by default

Most people will likely use logn and log10 most of the time, and these names
are not unique to Perl.

Reply via email to