From maechler at stat.math.ethz.ch  Mon Feb 27 13:03:31 2012
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 27 Feb 2012 13:03:31 +0100
Subject: [Rd] Identical copy of base function
In-Reply-To: <144b5f48a1aa59e2bbcd8b96a3990edd.squirrel@webmail.plus.net>
References: <144b5f48a1aa59e2bbcd8b96a3990edd.squirrel@webmail.plus.net>
Message-ID: <20299.28947.791010.435828@stat.math.ethz.ch>

>>>>> 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



[Rd] Identical copy of base function
Martin Maechler