[Rd] classed

Telford Tendys telford@progsoc.uts.edu.au
Fri, 15 Sep 2000 16:58:09 +1100


On Fri, Sep 15, 2000 at 02:21:29PM +1000, Bill Venables wrote:
> And nor does it.  What happens is that a new object is constructed from x,
> with (in this case) extra bits and pieces tacked on and (here) that new
> object is assigned the name y.
> 
> Writing a function to modify its argument is possible (e.g. fix() does it)
> but not altogether straightforward, especially if you want it to work in
> the most general case.

Hmmm, OK now that I test it out you are quite correct. But that implies
that the whole object is copied because later modification of either the
original or the result do not propagate between x and y... unless R has
some sort of copy-on-write flag which I never noticed when wandering 
through the R source (a lot probably falls into that category).

If it doesn't use copy-on-write then the result will be additional
slowdown when all your data is copied again and again (I guess it depends
on how big the object is).

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