From tlumley@u.washington.edu  Fri Mar 23 11:56:58 2001
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Fri, 23 Mar 2001 03:56:58 -0800 (PST)
Subject: [Rd] lazy evaluation and DUP=F
In-Reply-To: <3ABA26FF.B7BECF5F@bank-banque-canada.ca>
Message-ID: <Pine.A41.4.33.0103230351590.16764-100000@homer34.u.washington.edu>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] lazy evaluation and DUP=F
Thomas Lumley