Dear all, I've just discovered the 'Reference Classes'. In a previous attempt ---a year ago--- to re-implement in a Object Oriented fashion the AMORE package using S4 classes I strongly felt the need of such capability. It's great to have the Reference Classes now available. Along with the discovery of the Rcpp package, this new programming paradigm has boosted my interest in rewriting that package.
Nevertheless, I have found a surprising behavior in the $copy(shallow=FALSE) method. Let's have a look at the results which I believe are self-explanatories. The ".Data" field is a list which contains objects from the "Con" class ---connections for what is worth---. > p$copy(shallow=FALSE) -> k > p$.Data [[1]] An object of class "Con" <environment: 0x15a370c4> [[2]] An object of class "Con" <environment: 0x15b6ed94> [[3]] An object of class "Con" <environment: 0x15b4ba08> > k$.Data [[1]] An object of class "Con" <environment: 0x15a370c4> [[2]] An object of class "Con" <environment: 0x15b6ed94> [[3]] An object of class "Con" <environment: 0x15b4ba08> As you can see the elements of both lists share the memory addresses while I was expecting the shallow=FALSE to perform a deep copy and create copies of those objects as well. As I'm new with reference classes this causes me a lot of confussion. Is this a bug, is this a feature? Any insights about the matter are welcome Thanks in advance -M -- Manuel Castejón Limas University of León, Spain [email protected] [[alternative HTML version deleted]]
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
