Re: [Rd] Identical copy of base function

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Mon, 27 Feb 2012 13:03:31 +0100

>>>>> Matthew Dowle <mdowle_at_mdowle.plus.com> >>>>> on Mon, 27 Feb 2012 09:59:43 +0000 writes:

> Hello,

> Regarding this in R-devel/NEWS/New features :

> o 'library(pkg)' no longer warns about a conflict with a
> function from 'package:base' if the function is an
> identical copy of the base one but with a different
> environment.

> Why would one want an identical copy in a different
> environment? I'm thinking I may be missing out on a trick
> here.

Yes, you are ;-) The trick is called ``namespace'' :

One example which lead me to implement the above:

The Matrix package has had an identical copy of 'det' for a while now, but of course in the Matrix namespace. Because of that, the call to determinant() inside det() will correctly dispatch Matrix methods for determinant(), whereas base::det() would not.

Martin



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 27 Feb 2012 - 12:05:46 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 27 Feb 2012 - 15:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive