From murdoch at stats.uwo.ca  Wed Jul  2 02:29:06 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Tue, 01 Jul 2008 20:29:06 -0400
Subject: [Rd] get ...
In-Reply-To: <alpine.LFD.1.10.0806300950510.2815@nokomis.stat.uiowa.edu>
References: <971536df0806281246o75249479gaab3a059952e0f85@mail.gmail.com>	<4866A174.4050706@biostat.ku.dk>
	<alpine.LFD.1.10.0806300950510.2815@nokomis.stat.uiowa.edu>
Message-ID: <486ACBD2.60409@stats.uwo.ca>

On 30/06/2008 10:56 AM, Luke Tierney wrote:
> On Sat, 28 Jun 2008, Peter Dalgaard wrote:
> 
>> Gabor Grothendieck wrote:
>>> Suppose we do this:
>>>
>>>
>>>> f <- function(...) environment()
>>>> e <- f(a = 1, b = 2)
>>>> ls(e, all = TRUE)
>>>>
>>> [1] "..."
>>>
>>>> e$...
>>>>
>>> <...>
>>>
>>>> class(e$...)
>>>>
>>> [1] "..."
>>>
>>> Is there any way of getting a and b given e without
>>> modifying f?
>>>
>>> evalq(list(...),e)
>> $a
>> [1] 1
>>
>> $b
>> [1] 2
>>
>>
> 
> I'm wondering though whether we should allow the internal DOTSXP value
> of "..." to escape to the user level.  Might be more appropriate for
> get(e,"..."), e$... (and as.list.environment and maybe a few other
> things) to give the "Error: '...' used in an incorrect context" error
> if the value is a DOTSXP.

On the other hand, what Gabor sees in e is what he would see inside f:

> f <- function(...) { ls(all=T) }
> f(a=1, b=2)
[1] "..."
I don't think we should distinguish between user level in .GlobalEnv and 
what a user sees inside a function he writes.  Stopping a user from 
seeing ... inside a function would break all sorts of things.

Duncan Murdoch



[Rd] get ...
Duncan Murdoch