On 3/29/2006 7:48 AM, Martin Maechler wrote:> Hi Duncan,
>
> Just in case you haven't been alerted yet;
> I think the bug mentioned is caused by this change in coerce.c :
Thanks, I was just coming to the same conclusion. I'll look into it.
Duncan>
>
----------------------------------------------------------------------------
> r37269 | murdoch | 2006-02-05 18:00:54 +0100 (Sun, 05 Feb 2006) | 7 lines
>
> Changes to substitute and findVar:
> In C, substitute( , R_NilValue) does no substs, just
> getting PREXPRs, while substitute( , R_GlobalEnv) does
> substitutions.
>
> In R: substitute( , .GlobalEnv) is just like
> R_NilValue above, as is substitute( , NULL).
>
----------------------------------------------------------------------------
>
> Regards,
> Martin
>
>
> ------- start of forwarded message -------
> From: Peter Dalgaard <p.dalgaard at biostat.ku.dk>
> To: "Henrik Bengtsson" <hb at maths.lth.se>
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?
> Date: 29 Mar 2006 11:58:34 +0200
>
> "Henrik Bengtsson" <hb at maths.lth.se> writes:
>
>> Hi,
>>
>> I've got the following two versions of R on WinXP:
>>
>> A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243)
>> B) R Version 2.3.0 Under development (unstable) (2006-03-27 r37579)
>>
>> and a the following "test.R" script:
>>
>> foo <- function(path, ...) { print(path) }
>> bar <- function(x, ...) foo(...)
>> wow <- function(x, ...) capture.output(foo(...))
>> bar(1, path=2)
>> print(wow(1, path=2))
>>
>> With A, I get:
>>
>>> source("test.R")
>> [1] 2
>> [1] "[1] 2"
>>
>> But with B, I get
>>> source("test.R")
>> [1] 2
>> Error in print(path) : argument "path" is missing, with no
default
>>
>> Further debugging led me to the following test2.R script:
>>
>> foo <- function(path, ...) { print(path) }
>> bar <- function(x, ...) foo(...)
>> wow <- function(x, ...) yaa(foo(...))
>> yaa <- function(...) substitute(list(...))
>> bar(1, path=2)
>> print(wow(1, path=2))
>>
>> With A, I get
>>
>>> source("test2.R")
>> [1] 2
>> list(foo(...))
>>
>> But with B, I get
>>
>>> source("test.R")
>> [1] 2
>> list(foo())
>>
>> Note that '...' is missing in the latest version. I don't
think this is wanted.
>
> I suspect that you're right. Just for reproduction purposes: The
> script is not needed, and the whole thing simplifies to the two lines:
>
> yaa <- function(...) substitute(list(...))
> yaa(foo(...))
>
> which gives list(foo()) in 2.3.0 alpha and used to give list(foo(...)).
>