[Rd] reference class internals

2014-01-09 Thread Norm Matloff
I have a question about reference classes, which someone here undoubtedly can answer immediately, saving me hours of wading through indecipherable internal code. :-) Thanks in advance. Reference class data is mutable, fine, but in what sense? Is it really physical, or is it just a view given

Re: [Rd] reference class internals

2014-01-09 Thread Hadley Wickham
It's a bit of a simplification, reference classes are wrappers around environments. So if modifying a value in an environment would create a copy, then modifying the same value in a reference class will also create a copy. The situation with modifying a vector is a bit complicated as it will some

Re: [Rd] reference class internals

2014-01-09 Thread Norm Matloff
Bottom line: Really no different from the case of ordinary vectors that are not in reference classes, right? In other words, not true pass-by-reference. Norm On Thu, Jan 09, 2014 at 04:43:44PM -0600, Hadley Wickham wrote: > It's a bit of a simplification, reference classes are wrappers around

Re: [Rd] reference class internals

2014-01-09 Thread Simon Urbanek
On Jan 9, 2014, at 6:20 PM, Norm Matloff wrote: > Bottom line: Really no different from the case of ordinary vectors that are > not in reference classes, right? In other words, not true pass-by-reference. > The pass-by-reference applies to the object itself, not necessarily to anything you

Re: [Rd] reference class internals

2014-01-09 Thread Norm Matloff
Thanks, Hadley and Simon. The reason I asked today was that when reference classes first came out, it had appeared to me that there is no peformance advantage to using reference classes, that it was mainly a style issue (encapsulation, etc.). Unless I'm missing something, both of you have confir

Re: [Rd] reference class internals

2014-01-09 Thread Martin Morgan
On 01/09/2014 07:53 PM, Norm Matloff wrote: Thanks, Hadley and Simon. The reason I asked today was that when reference classes first came out, it had appeared to me that there is no peformance advantage to using reference classes, that it was mainly a style issue (encapsulation, etc.). Unless

Re: [Rd] reference class internals

2014-01-09 Thread Norm Matloff
I guess I should explain where I'm coming from in all this. I've always been something of a skeptic on object-oriented programming. Though I agree it has some advantages, and I do use it myself (in Python), in general I think it makes one work far too hard for the potential benefit. C++ template