Henrik Bengtsson
2001-Mar-27 22:11 UTC
[R] Library com.braju.oo provides reference variables
After posting (Mar 22 2001) a suggestion on how to call by reference using .Alias several people replied an said that .Alias should NOT be used for different reasons. I also found out that problems can occur when ".Alias pointers" is passed between different container objects (lists etc). The behavior of .Alias turned out to be unpredictable in some cases. In other words, ".Alias pointers" are out of the question. However, pointers, or preferable references, are important and needed. One reason is that reference variables are memory efficient. Another reason is that, the concept of reference variables allows you to have several container objects referring to the same object. For instance, you might want to have one list containing all red cars and another list containing all 4 cylinder cars. It might be that the two lists contains the same car(s). For memory reasons you do not want to keep copies of the common cars in the two lists. Also, you might want to do modifications to car objects, e.g. changing the license number. Such changes should be reflected in the objects contained in the two lists, without having to create new lists etc. I hope these arguments convince some that references are necessary. The library com.braju.oo provides the notion of references and objects. The library is written in 100% [R] so it should be possible to use the library on any system (I know for sure that it works on both Windows 98 and Sun Solaris). I have tested it myself for a couple of weeks and would now like to get other peoples opinion and feedback on it. The library seems to work as expected. However, it should still be considered as a beta version since the API might be changed. The com.braju.oo library can be downloaded at http://www.braju.com/R/com.braju.oo/ There you will also find [R] help files and some example code. Please, give me feedback on this one. Have a nice day Henrik Bengtsson Lund University & UC Berkeley henrikb at braju.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._