From andy_liaw at merck.com  Wed Nov 10 02:43:52 2004
From: andy_liaw at merck.com (Liaw, Andy)
Date: Wed Nov 10 02:44:17 2004
Subject: [Rd] recursive default argument reference
Message-ID: <3A822319EB35174CA3714066D590DCD50994E2BF@usrymx25.merck.com>

> From: Vadim Ogranovich
> 
> Hi,
> 
> It seems that a formal function argument can not default to an "outer"
> variable of the same name:
> 
> > x <- "foo"

This is just a red herring...  Even w/o this you get the same thing:

> ff <- function(x=x) x
> ff()
Error in ff() : recursive default argument reference
> ff(x)
Error in ff(x) : Object "x" not found

Note how the two errors are different.

> > ff <- function(x=x) x
> > ff()
> Error in ff() : recursive default argument reference
> > 
> 
> Is this intentional? Why?

It should be, because R doesn't know what to make of it (and neither do I).
 
Cheers,
Andy

> I use R-1.9.1.
> 
> Thanks,
> Vadim
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>


[Rd] recursive default argument reference
Liaw, Andy