Re: [Rd] topenv of emptyenv

2019-04-01 Thread Tomas Kalibera
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

Re: [Rd] topenv of emptyenv

2019-03-28 Thread Michael Lawrence via R-devel
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

Re: [Rd] topenv of emptyenv

2019-03-28 Thread Konrad Rudolph
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 _

Re: [Rd] topenv of emptyenv

2019-03-28 Thread Gábor Csárdi
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

Re: [Rd] topenv of emptyenv

2019-03-28 Thread Martin Maechler
> 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

[Rd] topenv of emptyenv

2019-03-23 Thread Konrad Rudolph
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