On 3/23/19 3:26 PM, Konrad Rudolph wrote:
I was surprised just now to find out that `topenv(emptyenv())` equals
… `.GlobalEnv`, not `emptyenv()`. From my understanding of the
description of `topenv`, it should walk up the chain of enclosing
environments (as if by calling `e = parent.env(e)` repea
And it is used profusely by the methods package.
On Thu, Mar 28, 2019 at 4:53 AM Gábor Csárdi wrote:
> On Thu, Mar 28, 2019 at 11:43 AM Martin Maechler
> wrote:
> [...]
> >
> > Indeed... and as I mentioned I had never actively noticed the
> > use of topenv() at all...
>
> FWIW topenv() is used
On Thu, Mar 28, 2019 at 11:42 AM Martin Maechler
wrote:
> So from that definition it must return .Globalenv in this
> particular case.
Indeed, that makes sense. Apparently the note wasn’t explicit enough
for me to make the connection.
--
Konrad Rudolph
_
On Thu, Mar 28, 2019 at 11:43 AM Martin Maechler
wrote:
[...]
>
> Indeed... and as I mentioned I had never actively noticed the
> use of topenv() at all...
FWIW topenv() is used in a couple of packages, although some of these
are false positives:
https://github.com/search?q=org%3Acran+topenv&type
> Konrad Rudolph
> on Sat, 23 Mar 2019 14:26:40 + writes:
> Konrad Rudolph
> on Sat, 23 Mar 2019 14:26:40 + writes:
> I was surprised just now to find out that `topenv(emptyenv())` equals
> … `.GlobalEnv`, not `emptyenv()`. From my understanding of the
I was surprised just now to find out that `topenv(emptyenv())` equals
… `.GlobalEnv`, not `emptyenv()`. From my understanding of the
description of `topenv`, it should walk up the chain of enclosing
environments (as if by calling `e = parent.env(e)` repeatedly; in
fact, that is almost exactly its i