[Rd] An artifact of base being namespace
Martin Maechler
maechler at stat.math.ethz.ch
Fri Oct 10 14:35:42 MEST 2003
>>>>> "Saikat" == Saikat DebRoy <saikat at stat.wisc.edu>
>>>>> on Thu, 9 Oct 2003 11:41:01 -0400 writes:
Saikat> Function in the base library of R 1.8.0 seems to use
Saikat> a search path with base coming before the local
Saikat> environment. I think this is intentional and is
Saikat> related to base being a namespace.
yes (intended and because base is a namespace).
> log <- function(x, base) 200
> log(1)
[1] 200
> log10
function (x)
log(x, 10)
<environment: namespace:base>
> log10(1)
[1] 0
>
Saikat> This is most problematic when you are creating a
Saikat> generic for an existing function in base (as you
Saikat> very well could for log). This often makes the
Saikat> ability to make new generics out of existing
Saikat> functions somewhat useless.
Assuming you're right, I'm much less sure that this consequence
has been intended in all situations. But I'd need to see
concrete examples to understand your last sentence.
Martin
More information about the R-devel
mailing list