[Rd] lazy evaluation and DUP=F

Thomas Lumley tlumley@u.washington.edu
Fri, 23 Mar 2001 03:56:58 -0800 (PST)


On Thu, 22 Mar 2001, Paul Gilbert wrote:

> I am having some difficulty understanding the implication of lazy
> evaluation mixed with DUP=F in a .Fortran call.  In qr.qty from base
> DUP is not used as an argument so defaults to T. I am calling qr.qty
> with a very large array and would like to set DUP=F in the .Fortran
> call so that qr.qty would be defined as copied below. Is there some
> risk that a variable used as the argument in the original calling
> environment would be modified, or is there some other reason that this
> should not be done?

I am not sure that DUP=FALSE can't change objects in the original calling
environment (this is why help(.Fortran) says that there is a risk). It's
not precisely lazy evaluation that causes the problem: if the lazy
evaluation really worked under the hood the way it appears to work there
would be no problem. The problem is that R actually calls by
reference until an object is modified. It should be fairly easy to tell by
experiment whether this can happen

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._