From murdoch at stats.uwo.ca  Mon Apr  3 14:36:53 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 03 Apr 2006 08:36:53 -0400
Subject: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?
In-Reply-To: <59d7961d0604030508m5904c588p37a5e9108d25afbb@mail.gmail.com>
References: <59d7961d0603290140y29d0b959w6fd6cc5a5a8dd24b@mail.gmail.com>	<x27j6dbmid.fsf@viggo.kubism.ku.dk>	<59d7961d0603290225rddfd4a1s5798db4ac91d086c@mail.gmail.com>
	<59d7961d0604030508m5904c588p37a5e9108d25afbb@mail.gmail.com>
Message-ID: <443116E5.7030705@stats.uwo.ca>

On 4/3/2006 8:08 AM, Henrik Bengtsson wrote:
> Follow up:  I've downloaded todays R v2.3.0 alpha (2006-04-02 r37626)
> for Windows and the below bug has been fixed:
> 
>> yaa <- function(...) substitute(list(...))
>> yaa(foo(x,y,...,z))
> list(foo(x, y, ..., z))
> 
> Thank you (Duncan!?)

Yes, I think it's fixed.  I also caught the older bug that

substitute(list(..., z), list(z=1))

returned list(..., z), instead of list(..., 1).  The presence of both 
bugs within a few lines of each other in the source made repairs much 
more interesting.

Duncan Murdoch

> Henrik
> 
> On 3/29/06, Henrik Bengtsson <hb at maths.lth.se> wrote:
>> On 29 Mar 2006 11:58:34 +0200, Peter Dalgaard <p.dalgaard at biostat.ku.dk> wrote:
>> > "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(...)).
>>
>> And, yaa(foo(x,y,...,z)) gives list(foo(x, y, z)) but used to give
>> list(foo(x, y, ..., z)).
>>
>> /Henrik
>>
>> >
>> > --
>> >    O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
>> >   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>> >  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
>> > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907
>> >
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?
Duncan Murdoch